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.
01 | while true do |
02 | print ( "Guy 2:Oh no, The game broke" ) |
03 | wait( 0.5 ) |
04 | print ( "Guy 1:What are we going to do?" ) |
05 | wait( 1 ) |
06 | print ( "Guy 2:Go on scripting helpers and find a new method." ) |
07 | wait( 9000 ) |
08 | print ( "Guy 1:Ok" ) :D |
09 |
10 | end |
1 | 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:
01 | local RoundTime = 180 |
02 |
03 | local function NewRound(Players) -- Teleport all players into a map of some kind, and give weapons |
04 | end |
05 |
06 | while wait(RoundTime) do |
07 | -- Teleport all players to a lobby |
08 | Wait( 30 ) -- Intermission time |
09 | NewRound(Game.Players:GetPlayers()) |
10 | end |