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

1 comment
You keep redefining x as one in the loop. Set "local x = 1" out of the loop, and then in the loop write "x = x + 1"