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.

01while true do
02print("Guy 2:Oh no, The game broke")
03wait(0.5)
04print("Guy 1:What are we going to do?")
05wait(1)
06print("Guy 2:Go on scripting helpers and find a new method.")
07wait(9000)
08print("Guy 1:Ok") :D
09 
10end
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
1while 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:

01local RoundTime = 180
02 
03local function NewRound(Players) -- Teleport all players into a map of some kind, and give weapons
04end
05 
06while wait(RoundTime) do
07    -- Teleport all players to a lobby
08    Wait(30) -- Intermission time
09    NewRound(Game.Players:GetPlayers())
10end
0
Thanks. supermanswaqq 65 — 9y
Ad

Answer this question