Script sometimes works but other times it doesn't work, not getting errors?
Asked by
7 years ago Edited 7 years ago
This script teams the player to Playing and in X amount of seconds respawns them in the lobby, for some reason when respawning the players so they can go onto the games map it doesn't work while other times it works. game https://www.roblox.com/games/1352607389/DominatedLegacys-Place-Number-240
002 | local Map = game.Workspace.Map |
003 | local Lobby = game.Workspace |
004 | local ZLobby = game.Teams.ZLobby |
005 | local TextValue = game.ReplicatedStorage:WaitForChild( "TextValue" ) |
006 | local Sounds = game.Workspace.Sounds |
007 | local NewSound = Instance.new( "Sound" ) |
008 | local maps = game.ReplicatedStorage:WaitForChild( "Maps" ) |
019 | local function Reward() |
021 | for _, player in pairs (game.Players:GetPlayers()) do |
022 | player.Playing.Value = true |
023 | if player.Playing.Value = = true then |
024 | player.Cash.Value = player.Cash.Value + 15 |
026 | print ( "Didn't play that round" ) |
034 | local function NoReward() |
036 | for _, player in pairs (game.Players:GetPlayers()) do |
037 | player.Playing.Value = false |
046 | local function LoadMap() |
047 | local mapList = maps:GetChildren() |
048 | local selectedIndex = math.random( 1 ,#mapList) |
049 | local map = mapList [ selectedIndex ] :Clone() |
050 | map.Parent = game.Workspace.Map |
054 | local function UnLoadMap() |
055 | game.Workspace.Map:ClearAllChildren() |
062 | TextValue.Value = "Intermission: " ..i |
073 | local function setTeam(player, teamName) |
074 | player.TeamColor = game.Teams [ teamName ] .TeamColor |
081 | for _, player in pairs (game.Players:GetPlayers()) do |
082 | setTeam(player, "Playing" ) |
083 | player:LoadCharacter() |
089 | for _, player in pairs (game.Players:GetPlayers()) do |
090 | setTeam(player, "ZLobby" ) |
097 | TextValue.Value = "Game In Progress" |
103 | for _,v in pairs (game.Players:GetPlayers()) do |
107 | TextValue.Value = "Game Over!" |
108 | NewSound.Parent = game.Workspace.Sounds |
110 | Sounds.Sound.Volume = 2 |
111 | Sounds.Sound.Playing = true |
114 | Sounds.Sound:remove() |
121 | while wait(gametime) do |