Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[SOLVED] How do I prevent this from not loading a map?

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

3 comments

0

try putting a wait(1) right after the while true loop

0

Don't think that'll do anything

0

you need to put wait() for while true do to work. Just put wait() without any number and it will work.

2 answers

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.

2 comments

0

I did publish, The script works for like 2 times and then stops and sends nothing to change the map..

0

you need to put wait() for while true do to work. Just put wait() without any number and it will work.

Answer by: Shounak123

" you need to put wait() for while true do to work. Just put wait() without any number and it will work"

This discussion is preserved as it was. New answers, comments, and votes are closed.