Map selector not selecting maps after 0 seconds?
I'm making a map selector for my game, The map gets selected but at 0 seconds it becomes negative and doesn't switch the map.
02 | local timecounter = Instance.new( "Hint" ,workspace) |
04 | local random = math.random( 1 ,#game.Lighting.Maps:GetChildren()) |
06 | game.Lighting.Maps.forest.Parent = workspace |
09 | game.Lighting.Maps.neighbourhood.Parent = workspace |
10 | return "neighbourhood" |
12 | game.Lighting.Maps.house.Parent = workspace |
15 | game.Lighting.Maps.city.Parent = workspace |
20 | coroutine.resume(coroutine.create( function () |
22 | timeleft = timeleft - 1 |
23 | timecounter.Text = "There is " ..timeleft.. " seconds left" |
24 | if timeleft = = "0" then |
28 | for i,v in pairs (game.Players:GetDescendants()) do |
29 | if v:IsA( "Player" ) then |
30 | v.Character.Humanoid.Health = 0 |