Hi i have a script that removes a few parts and clones a few but after it finishes it doesnt do it again even though i used repeat until and at the until i Nevers value is just a variable that will never change so the script will always repeat.
repeat wait(20) game.Workspace.Block.CanCollide = false wait(77) game.Workspace.Train:remove() game.ReplicatedStorage.Train:Clone().Parent = game.Workspace game.Workspace.Train:MakeJoints() game.Workspace.Block.CanCollide = true game.ReplicatedStorage.SpawnAll:Clone().Parent = game.Workspace wait(4) game.Workspace.SpawnAll:remove() game.Workspace.Block.CanCollide = true until game.Workspace.Never.Value == 1
Fore some reason the script only does this once and doesnt repeat like it should
If you want it to repeat try this... If it works I'll explain why.
Script #1
repeat wait(20) game.Workspace.Block.CanCollide = false wait(77) game.Workspace.Train:remove() game.ReplicatedStorage.Train:Clone().Parent = game.Workspace game.Workspace.Train:MakeJoints() game.Workspace.Block.CanCollide = true game.ReplicatedStorage.SpawnAll:Clone().Parent = game.Workspace wait(4) game.Workspace.SpawnAll:remove() game.Workspace.Block.CanCollide = true until game.Workspace.Never.Value >= 1
Script #2
while true do wait(20) game.Workspace.Block.CanCollide = false wait(77) game.Workspace.Train:remove() game.ReplicatedStorage.Train:Clone().Parent = game.Workspace game.Workspace.Train:MakeJoints() game.Workspace.Block.CanCollide = true game.ReplicatedStorage.SpawnAll:Clone().Parent = game.Workspace wait(4) game.Workspace.SpawnAll:remove() game.Workspace.Block.CanCollide = true end
Script #3
while wait() do wait(20) game.Workspace.Block.CanCollide = false wait(77) game.Workspace.Train:remove() game.ReplicatedStorage.Train:Clone().Parent = game.Workspace game.Workspace.Train:MakeJoints() game.Workspace.Block.CanCollide = true game.ReplicatedStorage.SpawnAll:Clone().Parent = game.Workspace wait(4) game.Workspace.SpawnAll:remove() game.Workspace.Block.CanCollide = true end
Look for other loops if they don't work. They all do the same thing.
While loops repeat something until the condition between the while
and do
keywords equals false. If you make the condition something that will never equal false, then it will run forever.
The best way to give it a condition that never equals false is to simply give it the word true
. Obviously, true
will never equal false
, as that would just go completely against all three laws of logic.
while true do wait() print("Spamming your output...") end
Remember that eternal loops must have at least a wait(0)
inside them somewhere, or else they will crash your game.
This is how you make an eternal loop -- if your script still won't work it's either because it's disabled or there's some other error inside of the loop. Please include all output errors (that have to do with your script) in your post.
this should work~
while true do wait(20) game.Workspace.Block.CanCollide = false wait(77) game.Workspace.Train:remove() game.ReplicatedStorage.Train:Clone().Parent = game.Workspace game.Workspace.Train:MakeJoints() game.Workspace.Block.CanCollide = true game.ReplicatedStorage.SpawnAll:Clone().Parent = game.Workspace wait(4) game.Workspace.SpawnAll:remove() game.Workspace.Block.CanCollide = true end
Locked by TheeDeathCaster and M39a9am3R
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?