I am working on a FNAF game as a commission from somebody, and I am trying to test this script. I am asking if the (for i=1, 10 do) part is going to work, and as I try to put it, make the script play itself ten times. I know everything else is correct, because I had time to test it. But I am just wondering, is there a mistake in it, or will it work when I have time to come back and test it?
Lighting = game.ServerStorage Seconde = wait() World = game.Workspace for i=1, 10 do while true do wait(20) World.TFred:Destroy() Lighting.TFred1:Clone().Parent = game.Workspace wait(20) World.TFred1:Destroy() Lighting.TFred2:Clone().Parent = game.Workspace wait(20) World.TFred2:Destroy() Lighting.TFred3:Clone().Parent = game.Workspace wait(20) World.TFred3:Destroy() Lighting.TFred4:Clone().Parent = game.Workspace wait(20) World.TFred4:Destroy() Lighting.TFred:Clone().Parent = game.Workspace end
And for the sarcastic people saying, "you could've tested it instead of using your time to ask this", I can't because ROBLOX STUDIO isn't working at the moment for me.
Put this instead:
Lighting = game.ServerStorage Seconde = wait() World = game.Workspace for i=1, 10 do wait(20) World.TFred:Destroy() Lighting.TFred1:Clone().Parent = game.Workspace wait(20) World.TFred1:Destroy() Lighting.TFred2:Clone().Parent = game.Workspace wait(20) World.TFred2:Destroy() Lighting.TFred3:Clone().Parent = game.Workspace wait(20) World.TFred3:Destroy() Lighting.TFred4:Clone().Parent = game.Workspace wait(20) World.TFred4:Destroy() Lighting.TFred:Clone().Parent = game.Workspace end
the for loop alone will repeat the script ten times, adding a while loop would require you add another "end."