|
I'm trying to make a script that changes the value of IntValue in LocalPlayer. Here is the script I'm trying to make
print("Money Giver Script Loaded")
local Player = game.Players.LocalPlayer
local Money = Player.Robux -- IntValue
while true do
wait(5)
Money.Value = Money.Value + 100
end
|
|
|
What is wrong with it? It's not working
|
|
|
Is it in a server script? Are you getting any errors? |
|
kylerzongJoin Date: 2011-08-06 Post Count: 659 |
local Player = game.Players.LocalPlayer
if Player then
print("PlayerFound")
local Money = Player.Robux -- IntValue
else
print(":C")
end
if Money then
print("Money Found")
else
print(":C2")
end
while true do
wait(5)
Money.Value = Money.Value + 100
print("Money Given")
end
|
|
kylerzongJoin Date: 2011-08-06 Post Count: 659 |
Run This And Tell Me What It Says |
|
|
No errors in Output but where do I put the script. It's in workspace right now
|
|
kylerzongJoin Date: 2011-08-06 Post Count: 659 |
Bro put it in StarterPlayer>StarterPlayerScripts................... |
|
|
IvanL2Join Date: 2015-08-18 Post Count: 209 |
It's a local script.
If not, it should be, as game.Players.LocalPlayer only applies to local scripts.
If it is, make sure it is stored inside the player's scripts, instance, or character, for it to run. |
|
|
It is in a LocalScript and it's in StarterPlayerScripts
|
|
|
Place this script in ServerScriptService.
amount = AMOUNTGOESHERE
currencyname = "CURRENCYGOESHERE"
while true do
wait(TIMEGOESHERE)
for i,v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("leaderstats") and v then
v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amount
end
end
end
|
|
|
It's not a leaderstat though It's just a IntValue in LocalPlayer
|
|
|
Guess you didn't want my help.
|
|
|
Hmm.. Can you tell me where the script and the value is exactly placed?..
Giving such information can make finding a solution for you easier |
|
|
Just use a normal script:
game.Players.PlayerAdded:connect(function(player)
Money = player.Robux
while true do
wait(5)
Money.Value = Money.Value + 100
end
end)
At least I tried to help.
|
|
|
Try making the script without variables So it would be like: while true do wait(5) game.Players.LocalPlayer.Robux.Value = game.Players.LocalPlayer.Robux.Value + 100 end if that didnt manage to work then try changing the script and the value places Steps: 1- Change your script place inside the StarterPlayer inside the StarterPlayerScripts 2- Delete the int value since you will make on e via script 3- In your script write this: local Robux = Instance.new("IntValue", script) -- Make a new IntValue and set its parent ########## = "Robux" -- Set the Name of your value while true do Robux.Value = Robux.Value + 100 wait(5) end Tell me if that works and if you need any more help |
|
TimeTicksJoin Date: 2011-04-27 Post Count: 27115 |
--server script
game.Players.PlayerAdded:connect(function(player)
local stats = player:WaitForChild('leaderstats')
local money = stats:WaitForChild('Money')
spawn(function()
while wait(5) do
money.Value = money.Value + 100
end
end)
end)
|
|
|
i dont understand why you are doing this |
|
decla123Join Date: 2011-06-08 Post Count: 112 |
--Local Script inside StarterPlayer
local plr = game.Players.LocalPlayer
local stats = plr:WaitForChild("leaderstats")
local money = stats:WaitForChild("Money")
while true do
money.Value = money.Value + 100
wait(5)
end |
|