I'm trying to make a 'Cash' variable that adds up over time. I don't think this is the right script, was a try though!
while true do Cash = Cash + 5 Game.workspace.Part.SurfaceGUI.TextBox.Text = Cash wait (20) end
A simple error: there was a space in between the wait and the parameter. This can easily be fixed by doing:
local Cash = 0 while wait(20) do Cash = Cash + 5 game.workspace.Part.SurfaceGUI.TextBox.Text = tostring(Cash) end
I also recommend you use a TextLabel
and not a TextBox
Edit: I realized that the value would be a number value so you must make it a string for it to work. I provided that in the code above