Object must be a member of workspace before loading animation
It is a little long but I will add a comment pointing to where the error is. Look for stars.
wait(5) -- wait for players character to load local intermission = 10 local timeConst = 120 -- this is the time of the match. It makes sure that the time is always correct local matchTime = timeConst -- 2 minutes local firstRun = true local message = Instance.new("Message") local ss = game:WaitForChild("ServerStorage") local gear = ss:WaitForChild("Gear") local maps = ss:WaitForChild("Maps") local plrs = game:WaitForChild("Players") local teams = game.Teams while wait(1) do if firstRun == true then print("First Run") -- debug wait(1) firstRun = false end while true do print("First Loop Initiated") contestants = {} wait(1) -- allow time for all contestants to load for k,plr in pairs (game.Players:GetChildren()) do if plr and plr.Character then print("player and char") local humanoid = plr.Character:FindFirstChild("Humanoid") if humanoid and humanoid.Health > 0 then print("Humanoid") table.insert(contestants, plr) end end end if #contestants >= 2 then print("contestants") wait(1) break else print('waiting for players') end wait(1) end ----------------[LoadMap]-------------------- --local randomMap = maps[math.random(1, #maps)]:Clone() --randomMap.Parent = game.workspace -- The above is commented to be fixed later. -- For now I will use the map loading system that only allows one map ss.Maps.ForestMap.Parent = workspace print("Map should be loaded") --------------------------------------------- --------------------[Intermission]------------------------------ while wait(1) do print("Intermission Loop Initiated") if intermission ~= 0 then intermission = intermission - 1 message.Parent = workspace message.Text = "Game begins in: "..intermission.."" elseif intermission <= 0 then message.Parent = nil wait(0.5) break end end --------------------------------------------------------------- local numofplayers = game.Players.NumPlayers -- loop once for every player local looptime = numofplayers -- This may be a bit buggy. while wait(1) do if looptime > 0 then looptime = looptime - 1 end for _, player in pairs (contestants) do print("Preparing character for match") if player and player.Character then print("Player and player's char loaded") -- I removed the torso variable as I couldn't see it's point local humanoid = player.Character:FindFirstChild("Humanoid") if humanoid then print("Humanoid detection") humanoid.Health = 100 -- Not sure what the point of this is end matchTag = Instance.new("StringValue") matchTag.Name = "MatchTag" player.TeamColor = teams.Battling.TeamColor deathScript = ss:WaitForChild("DeathScript"):Clone() deathScript.Disabled = false end end if looptime <= 0 then looptime = numofplayers break end end -- ********The loop below is when the error occurs. ******* -- -- the use of looptime is not a preferable method but the only thing I could think of to do what I needed. while looptime > 0 do wait() print('Loading character') for i, p in pairs (contestants) do p:LoadCharacter() matchTag.Parent = p.Character -- If the player dies the matchtag will be removed automatically. Saves a little work for me. deathScript.Parent = p.Character local allGear = gear:GetChildren() local randomGear = allGear[math.random(1, #allGear)]:Clone() randomGear.Parent = p.Backpack end end looptime = numofplayers while wait(1) do matchTime = matchTime - 1 print("Run") local battling = {} for _, player in pairs (game.Players:GetChildren()) do if player then repeat wait() until player.Character local humanoid = player.Character:FindFirstChild("Humanoid") local matchTag = player.Character:FindFirstChild("MatchTag") if player.Character.MatchTag then table.insert(battling, player) else error("MatchTag not found") end end end if #battling < 1 then print("All are dead") break elseif #battling == 1 then print("We have a winner") break elseif #battling > 1 then print(matchTime) elseif matchTime <= 0 then matchTime = timeConst break end end wait() for _, player in pairs (contestants) do if player and player.Character then local humanoid = player.Character:FindFirstChild("Humanoid") local matchTag = player.Character:FindFirstChild("MatchTag") player.TeamColor = game.Teams.Lobby.TeamColor if humanoid then humanoid:UnequipTools() end if matchTag then matchTag:Destroy() end end local Backpack = player:FindFirstChild("Backpack") if Backpack then Backpack:ClearAllChildren() print("Backpack cleared") end if player.Character:FindFirstChild("DeathScript") then player.Character.DeathScript.Parent = nil end end game.workspace:WaitForChild("ForestMap").Parent = maps end --[[ Log The previous script was working perfectly until I realized I hadn't created a way to add players to tables and check them Working on this script I am running in to the same problems you were and a few more. Both characters now load but they fall in to a loading loop. I can either break the loop and then create another loop that loads the characters or create a conditional to determine if the players are loaded and then break the loop. I removed the machine gun as it caused a major error loop not allowing the script to execute. players now loads correctly. --]]
everything here looks fine, but sometimes you just have to look at what roblox does, they debug studio all day, so getting errors that dont revolve around your script is constantly happening.