The map load works in studio, but in game... When a map change it changes, but when it change again it stops working and just sends out nothing at all. (This is a script for a friend I'm currently making... Belongs in ServerScriptService)
local maps = game.Lighting.Maps:GetChildren() --Where the map belongs and how the script grabs it local msg = Instance.new("Message") local Death = game.Workspace.Baseplate while true do -- a loop Death.CanCollide = true -- just incase line 19 fails msg.Parent = game.Workspace msg.Text = ("Loading New Map (Same map will occur, I can't prevent that since this randomizes.)") wait(7) chosenmap = maps[math.random(1,#maps)] -- gets a random map chosenmap:Clone().Parent = workspace -- sets the parent to workspace msg:remove() Death.CanCollide = false for i,v in pairs(game.Players:GetChildren())do if v.Character then v.Character.Torso.CFrame = workspace:FindFirstChild(chosenmap.Name).Spawn.CFrame -- when map loads, people gets teleported over there (MUST HAVE PART IN MAP NAMED "Spawn"!!!) Death.CanCollide = false -- just incase line 13 fails wait(100) -- time of the round workspace:FindFirstChild(chosenmap.Name):Destroy() -- destroys the map after timer Death.CanCollide = true wait(.5) end end end
I think you forgot to publish your place. Click File on the upper left corner, then click Publish To Roblox. In this way, you can make it as it is in the studio.
Answer by: Shounak123
" you need to put wait() for while true do to work. Just put wait() without any number and it will work"