Text is not reading Value after time

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.

1 Like

I don′t think so…
Classic Baseplate - Roblox Studio 29. 12. 2022 15_20_18
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.

I used it…

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.

Same Result (Shows only one number)

1 Like

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…

1 Like

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.

It is a localscript.

You better look here.

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

1 Like

Dam just read it in the documentation, thank you very much for this information, :star2: The more you know :star2:

1 Like

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