Hi! I need help adding 1 value to a Surface Gui I have in a loop. I thought that this would just wait 1 second, then add 1 value to the already existing value over and over again, but I was wrong. Any help would be greatly appreciated!
You can’t combine a number with a string, but tostring() and tonumber() exists. For example,
local debounce = false
local current = 0
game.Workspace.Buttons.Dropper1Button.Touched:Connect(function(Add)
if not debounce then debounce = true
script.Parent.Text = current
task.wait(1)
script.Parent.Text = tostring(current += 1)
current += 1
debounce = false
end
end)
tostring() converts numbers into a string. tonumber() converts a string into a number. (if it contains numbers of course)
Adding on to this, you can add a debounce so it wont bug as much.