SecTime = game.workspace:GetAttribute("Second")
while true do
wait(1)
SecTime = SecTime + 1
game.Workspace:SetAttribute("Second", SecTime)
end
It gives me a error, attempting to do arithmetic at line 4. How do i fix it
SecTime = game.workspace:GetAttribute("Second")
while true do
wait(1)
SecTime = SecTime + 1
game.Workspace:SetAttribute("Second", SecTime)
end
It gives me a error, attempting to do arithmetic at line 4. How do i fix it
Hello!
You see, strings can not be added, subtracted, multiplied, whatever, with a number. What you can do, is to first convert the string to a number, and then convert it back to a string.
local string = "200"
local finalnumber = tonumber(string) + 300
local finalstring = tostring(finalnumber)
If you're confused, you can go here for an article about strings and their behavior.
I hope this helps!
your code was much deprecation
local start = os.time()
while true do
local now = os.time()
workspace:SetAttribute("Second", math.floor(now - start))
wait(0.5)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
haven’t used attributes but I’m pretty sure I remember that you can choose what type they are (string, number, etc) you probably made it a string by accident