Change it to PlayerGui and you’re good to go. Except that script is atrocious.
Players.LocalPlayer.PlayerGui
, not pure PlayerGui.
Your scripts need a lot of cleanup.
Change it to PlayerGui and you’re good to go. Except that script is atrocious.
Players.LocalPlayer.PlayerGui
, not pure PlayerGui.
Your scripts need a lot of cleanup.
I don′t think so…
Note that the value now doesn′t change.
Combine what others said: Modify the value from the server, declare variables instead of doing script.Parent.Parent.Parent.Parent.Parent.Parent
and whatever. Place IntValues in a folder in the Player instead of the PlayerGui, use task.wait()
instead of wait()
, and other stuff.
Heh heh, you forgot this. Maybe you didn’t see the edit.
Oh wait, it won’t do if you’re using a Script. Use a Localscript to declare LocalPlayer.
Actually I’ll do this for you. Give me a minute.
Can you show me all script that is needed for the value to change and change the text
The one that shows money
while true do
wait(0.5)
script.Parent.Text = script.Parent.Parent.Money.Value
end
The one that costs money
while true do
wait(0.5)
script.Parent.Parent.Parent.StarterGui.thegui.Money.Value -= 1
end
try this for the showing script:
game:GetService("RunService").RenderStepped:Connect(function()
script.Parent.Text = script.Parent.Parent.Money.Value
end)
You need to change the money from a serverscript, and when getting a player’s UI you wont be using StarterGui. You want to use PlayerGui since each player has their own.
So you should do this.
game.Players.PlayerAdded:Connect(function(player)
task.spawn(function()
while wait(0.5) do
player:WaitForChild('PlayerGui'):WaitForChild('thegui').Money.Value -= 1
end
end
end
Your other script seems to work, but you should use GetPropertyChangedSignal as the other one could lead to a bad habit.
mabye make the values change on server script
It doesn’t matter. Previously, I made it on server side and the result was like on the first post…
The problem is that you are using a script instead of a localscript, and since youre chaning the value on a localscript it does not update the text to what it should be.
Basically, make the script a localscript instead.
here try this but check the output
while true do
wait(0.5)
print("value changing")
script.Parent.Text = script.Parent.Parent.Money.Value
end
Common misconception.
In this case you’d be wrong, when you are using the .Changed
on a “ValueObject” (like Int, StringValue, etc.) then the event only fires upon the Value' property change. So it’s actually better to use
.Changed`, it’s shorter and automatically passes the new value
Dam just read it in the documentation, thank you very much for this information, The more you know
Ye, the print is working…
NOW try this
while true do
wait(0.5)
print("value changing")
print(script.Parent.Parent.Money.Value)
script.Parent.Text = script.Parent.Parent.Money.Value
end