i need to know how to tp to map using this script because im not being tped to map

local game_length = 40 -- every X seconds, end the game, show a message, regen the map, rebalance teams, cause MASSIVE LAG

message = nil function showMessage(text) -- This function flashes a message to all players -- Clear the message with hideMessage()

hideMessage() -- Never show more than one message at a time
if message == nil then message = Instance.new("Message") end -- only make a message if we don't have a message object lying around
message.Text = text
message.Parent = game.Workspace

end

function hideMessage() if message == nil then return end message.Parent = nil end

function clearPlayerInfo() -- resets KOs and WOs local players = game.Players:children() for i = 1, #players do if (players[i]:findFirstChild("leaderstats") ~= nil) and (players[i].leaderstats.KOs ~= nil) then players[i].leaderstats.KOs.Value = 0 end if (players[i]:findFirstChild("leaderstats") ~= nil) and (players[i].leaderstats.Wipeouts ~= nil) then players[i].leaderstats.Wipeouts.Value = 0 end end end

function getWinnerInfo() -- returns a string that we display to everyone about who the winner is

-- in case of tie, no one wins. if someone wants to code something better, be my guest.
local highscore = 0
local winner = "No one"
local tie = false

local players = game.Players:children()
for i = 1, #players do
	local pscore = -1
	if players[i]:findFirstChild("leaderstats") ~= nil then 
		if players[i].leaderstats.Points ~= nil then 
			pscore = players[i].leaderstats.Points.Value 
		end
	end

	if pscore == highscore then
		tie = true
	end

	if pscore > highscore then 
		-- new highscore
		highscore = pscore
		winner = players[i].Name
		tie = false
	end
end

if tie == true then return "There was a tie. How boring." end

local text = string.format("%s %s %d %s", winner, "wins with", highscore, "points!")
return text

end

function getWinningTeamString() local red = 0 local blue = 0

local p = game.Players:children()
for i=1,#p do
	if (p[i].TeamColor == game.Teams:findFirstChild("Blue").TeamColor) then
		if (p[i]:findFirstChild("leaderstats") ~= nil and p[i].leaderstats.KOs ~= nil) then
			blue = blue + p[i].leaderstats.KOs.Value
		end
	end

	if (p[i].TeamColor == game.Teams:findFirstChild("Red").TeamColor) then
		if (p[i]:findFirstChild("leaderstats") ~= nil and p[i].leaderstats.KOs ~= nil) then
			red = red + p[i].leaderstats.KOs.Value
		end
	end
end

if (red == blue) then return "Red and Blue tied. How boring!" end

if (red > blue) then return string.format("Red won the match by %d points!", red - blue) end

return string.format("Blue won the match by %d points!", blue - red)

end

while true do wait(game_length - 30) showMessage("30 seconds left until end of game!") wait(5) hideMessage() wait(25)

-- put up winning team info
showMessage(getWinningTeamString())
wait(2)

hideMessage() wait(2) game.Workspace.Map.Parent = game.Lighting wait(2) game.Lighting.Map.Parent = game.Workspace wait(2)

showMessage("Rebalancing teams and launching new game...")
wait(5)
clearPlayerInfo()
game.Teams:rebalanceTeams()

hideMessage()

end

3 comments

2

It hurst my eyes badly.

0

Please fix your formatting. I assume this is all supposed to be a single script, but the way you have it set it looks like individual code blocks.

0

Put your code in a code block.