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

Can someone help me find the error in this script?

I can't find the error in this script. It's supposed to generate random maps and teleport people to them using a block called "Tele Brick" which is placed within each map, but nothing happens. These maps are also all placed in lighting, by the way.

Intermission = 10  
PlayTime = 90


while true do
	wait(Intermission) 
	
		Maps = (math.random(1,2)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
		if Maps == 1 then
		Message = game.Players.LocalPlayer.PlayerGui.Output.Message
		Message.Text = "Map: Cobblestone Obby, by Miike0" 
		wait(5) 
		Message.Text = "Loading Map."
		wait(.5)
		Message.Text = "Loading Map.."
		wait(.5)
		Message.Text = "Loading Map..."
		wait(.5) 
		Message.Text = "Loading Map."
		wait(.1)
		Message.Text = "Teleporting Players"
		wait(.5)
		map = game.Lighting:FindFirstChild("Cobblestone Obby"):Clone()
		map.Parent = game.Workspace
		map.Name = "Map"
		map:MakeJoints()
		target = game.Workspace.Map["Tele Brick"] 
		for i, v in pairs(game.Players:GetChildren()) do
		v.Character.Torso.CFrame = target.CFrame + Vector3.new(0,4,0)
		Message.Text = "Good luck!"
		wait(2)
		Message.Transparency = 1	
		end
		wait(90) 
		Message.Transparency = .2
		game.Workspace.Map:remove()
	end 
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
		if Maps == 2 then 
		Message = game.Players.LocalPlayer.PlayerGui.Output.Message
		Message.Text = "Map: Bonus Obby, by Miike0" 
		wait(5) 
		Message.Text = "Loading Map."
		wait(.5)
		Message.Text = "Loading Map.."
		wait(.5)
		Message.Text = "Loading Map..."
		wait(.5) 
		Message.Text = "Loading Map."
		wait(.1)
		Message.Text = "Teleporting Players"
		wait(.5)
		map = game.Lighting:FindFirstChild("Bonus Obby"):Clone() 
		map.Parent = game.Workspace
		map.Name = "Map"
		map:MakeJoints()
		target = game.Workspace.Map["Tele Brick"] 
		for i, v in pairs(game.Players:GetChildren()) do
		v.Character.Torso.CFrame = target.CFrame + Vector3.new(0,4,0)
		Message.Text = "Good luck!"
		wait(2)
		Message.Transparency = 1	
		end
		wait(90) 
		Message.Transparency = .2
		game.Workspace.Map:remove()
	end 

2 comments

0

have you tried debugging? which is placing prints everywhere and finding out where it stops

0

I have, but I'll try again.

1 answer

✓ Accepted answer
Maps = (math.random(1,2)

should be

Maps = math.random(1,2)

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