Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How to make a script repeat itself?

Asked by 9 years ago

I am wandering how i can make this script repeat:


for i=1, 10 do wait(5) local players = game.Players:GetChildren() print(#players) if #players >= 1 then local murder = players[math.random(1,#players)] local Knife = game.Lighting.Knife:Clone() Knife.Parent = murder.Backpack wait(10) end end

It keeps doing the wait(10) one, not going back to wait(5) then ten and again. Please help i am new at all this and am trying to make a game.

1
Can you please edit your post to use the Lua code formatting feature? BlueTaslem 18071 — 9y
0
Hi i did what you asked! 4SeaBass 0 — 9y

1 answer

Log in to vote
0
Answered by
Nrav 0
9 years ago

The best way to do this is by using

while true do
-- your script here
0
Hey, i have tried that but it still does ten over and over instead of starting completely over again and agian. 4SeaBass 0 — 9y
0
A simple answer to this is to make 10 equal something like the letter i does. Make j = 10 or something Nrav 0 — 9y
Ad

Answer this question