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

Teleporting in round script not working?

so i have been working on a round script and it all work well in studios but when i play the game the teleport part is not working. What should i do?

local replicatedstorage = game:GetService('ReplicatedStorage') 
local status = replicatedstorage:WaitForChild('StatusValue')
local mapstorage = game.Workspace:WaitForChild('mapStorage')
while true do
	
while game.Players.NumPlayers < 1 do 
		status.Value = "2 or more players are required to begin!"
		repeat wait(2) until game.Players.NumPlayers >= 1
end

for i = 10,0,-1 do -- intermission 
	status.Value = "Intermission... "..i
	wait(1)
end
_G.gameplayers = {}
for i, v in pairs(game.Players:GetPlayers()) do

if v then
	table.insert(_G.gameplayers, v.Name)
end

end



local mapsinserverstorage = game:GetService('ServerStorage'):GetChildren()  
local chosenmap = mapsinserverstorage[math.random(1, #mapsinserverstorage)]
chosenmap:Clone().Parent = mapstorage
wait(1)
status.Value = "Map chosen: "..chosenmap.Name
wait(3)
status.Value = "Get ready to be teleported!"
wait(5)
local spawns = chosenmap:WaitForChild('Spawns'):GetChildren()
for _, player in pairs (game.Players:GetPlayers()) do
	if player and #spawns > 0 then
		local Torso = player.Character:WaitForChild('Torso')
		local allspawns = math.random(1, #spawns)
		local randomspawn = spawns[allspawns]
		if randomspawn and Torso then
			table.remove(spawns, allspawns)
			Torso.CFrame = CFrame.new(randomspawn.Position + Vector3.new(0,2,0))
			
			function fadeTo(a, b, c)
	for transparency = a, b, c do

 
		for _, part in pairs(player.Character:GetChildren()) do
	
 
			if part:IsA("BasePart") then

 
				part.Transparency = transparency

			end
		end
		wait(0.1)
	end
end
			
			local primary = game.ReplicatedStorage.SMG 
			local newprimary = primary:Clone()
			newprimary.Parent = player.Backpack
			
		end
	end
end
status.Value = "Start Killing!" 
wait(4)
for i = 120,0,-1 do 
	if i == 0 then
		status.Value = "Time Up!"
		wait(3)
		break
    end
	wait(1)
	if #_G.gameplayers == 1 then
		for i, v in pairs(_G.gameplayers) do
			if v ~= nil then
				status.Value = v.." is the Winner!"
				game.Players[v].leaderstats.Cash.Value = game.Players[v].leaderstats.Cash.Value + 100 -- The #15 will be how much credit or cash is awarded to the player if there was only one player teleported.
				break
			end
		
		end
        break
	else
	    status.Value = i.."..Seconds Remaining!"
	end
end
	
mapstorage:ClearAllChildren()
wait(1)
for i, player in ipairs(game.Players:GetPlayers()) do
	if player.Character then
		local hum = player.Character:FindFirstChild('Humanoid')
		if hum then
			hum.Health = 0
		end	
end
end
end

2 comments

0

Could you give us the output please? Thanks. ^^

0

Jacob200523@ is probably that your having problems with FE, i did that once and didnt work in game

1 answer

Guys never mind i found the issue!

    local Torso = player.Character:WaitForChild('Torso')

that sections is wrong its torso is not the primary part anymore! so the script should be!

    local Torso = player.Character:WaitForChild('Head')

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