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

What is the best function to use?

Asked by 9 years ago

I need to know what the best function for a game script is. By function I mean While true do and stuff. I know while true do isn't the best but it was just an example. Please answer with the best function.

To make it look like help here.

while true do
print("Guy 2:Oh no, The game broke") 
wait(0.5)
print("Guy 1:What are we going to do?")
wait(1)
print("Guy 2:Go on scripting helpers and find a new method.")
wait(9000)
print("Guy 1:Ok") :D

end
0
You could use while wait(1) do instead of while true do. ISellCows 2 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago
while true do end

will run continuously, with no end, so "Guy 2" will eventually just repeat himself a thousand times.

Game scripts can be very complex, if you can't understand moderate scripting I would suggest simply doing something very basic, which does indeed mean using a while loop. Perhaps you can do something like this:

local RoundTime = 180

local function NewRound(Players) -- Teleport all players into a map of some kind, and give weapons
end

while wait(RoundTime) do
    -- Teleport all players to a lobby
    Wait(30) -- Intermission time
    NewRound(Game.Players:GetPlayers())
end
0
Thanks. supermanswaqq 65 — 9y
Ad

Answer this question