p = script.Parent while true do local pl = game["Workspace"]:FindFirstChild("FlickeringLight").PointLight local x = 1 wait(0.1) pl.Enabled = false p.Material = 256 p.BrickColor = BrickColor.new(Color3.new(0, 0, 0)) wait(0.02) pl.Enabled = true p.Material = 288 p.BrickColor = BrickColor.Yellow() wait(0.002) pl.Enabled = false p.Material = 256 p.BrickColor = BrickColor.new(Color3.new(0, 0, 0)) wait(0.2) pl.Enabled = true p.Material = 288 p.BrickColor = BrickColor.Yellow() print("Flicker " + x+1) end
I want to make x keep increasing by one every time a loop goes through. but it comes out with this error message.
Workspace.FlickeringLight.Script:23: attempt to perform arithmetic on a string value
Your syntax is wrong. To add something on to a string, do:
print("String " .. x + 1)
Note the ..
Also:
This will not add 1 to x
every time it loops. Define x
outside of the while loop, then add to it inside.
local x = 1 while true do wait(1) x = x + 1 print("String " ..x) end