Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make it so that the text updates correctly?

The only thing that does not work is that the text of the TextBox is not being updated.

wait(2)
for _,v in pairs(workspace:GetChildren()) do 
	if v:IsA('BasePart') and not v.Name == "Terrain" then 
		v.Touched:connect(function(hit) 
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			if player ~= nil then
				local cash = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
				game.Workspace.Display.GUI.Amount.Text = "$ "..cash.Value
				end
		end) 
	end 
	
end

1 answer

Use the Changed Event. Basically, when the Value of the Cash changes, it will fire a function and change the text. Here is an example:

cash.Changed:connect(function()
game.Workspace.Display.GUI.Amount = "$ "..cash.Value
end)

What the above will do is it will update the text every time the Value is changed.

1 comment

0

This question was posted over a year ago.... xD I know how to do it now.

This discussion is preserved as it was. New answers, comments, and votes are closed.