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

Help on Custom Map Changer? [Script Inside]

The goal is for it to teleport every player in the server within the defined borders every (300) then delete the old map, clone the new map, and then respawn the players. Please post a fixed version if you can do so. Thanks!

Here is the script:

local MaxTele = Vector2.new(106, -371)
local MinTele = Vector2.new(66, -332)
local TeleHeight = 70.814

local function TeleportPlayer(Player)
	if Player and Player.Character and Player.Character:FindFirstChild("Torso") then
		local Position = Vector3.new(math.random(MinTele.X,MaxTele.X),TeleHeight,math.random(MinTele.Y,MaxTele.Y))
		Player.Character:MoveTo(Position)
	end
end


while true do
	wait(10)--Map time (300)
	local modelGroup = game.ReplicatedStorage:FindFirstChild("Maps"):GetChildren()
	local PickedModel = modelGroup[math.random(1, #modelGroup)]
	local Model = PickedModel:Clone()
	if game.Workspace:FindFirstChild("Map") then

	game.Workspace.Map:Destroy()
	end
	--Teleport players to area (LOCAL DEFINITIONS)
	
	for i,v in pairs(game.Players:GetPlayers()) do
		TeleportPlayer(v)
	end
	
	wait(5)
	for i, v in pairs(game.Players:GetChildren()) do
	v:LoadCharacter() end

	wait(1)

	Model.Parent = game.Workspace


	end

1 answer

The answer: If there is a problem, always DC it. If you don't DC it, It can be difficult.

2 comments

0

DC?

0

Double Check.

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