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

Why is this teleporting script not working?

This script is supposed to teleport players once every life. However, the script doesn't work, but output did give me feedback. Can someone please help me?

Output: 11:03:09.389 - Teleportedd is not a valid member of Player 11:03:09.390 - Script 'Workspace.Player.Fix', Line 5

Script:

local Playing = game.ServerScriptService.MainGameScript.Variables:WaitForChild("Playing")
local Player = game.Players.LocalPlayer
local TeleVal = Player:WaitForChild("Teleportedd")

while wait(0.01) do
	if Playing.Value == true and TeleVal.Value == false then
		TeleVal.Value = true
		BB = {} 
		DD = {}
		GG = {}
		RR = {}
		for i,v in ipairs(game.Workspace.Map.Spawns.BBS:GetChildren()) do
		if v.Name == "Spawn" then
				table.insert(BB,v)
			end
		end
		for i,v in ipairs(game.Workspace.Map.Spawns.DDS:GetChildren()) do
			if v.Name == "Spawn" then
				table.insert(DD,v)
			end
		end
		for i,v in ipairs(game.Workspace.Map.Spawns.GGS:GetChildren()) do
			if v.Name == "Spawn" then
				table.insert(GG,v)
			end
		end
		for i,v in ipairs(game.Workspace.Map.Spawns.RRS:GetChildren()) do
			if v.Name == "Spawn" then
				table.insert(RR,v)
			end
		end
		if Player.TeamColor == BrickColor.new("Bright red") then
			Player.Character:MoveTo(RR[math.random(1,#RR)].CFrame)
		elseif Player.TeamColor == BrickColor.new("Bright blue") then
			Player.Character:MoveTo(BB[math.random(1,#BB)].CFrame)	
		elseif Player.TeamColor == BrickColor.new("Bright yellow") then
			Player.Character:MoveTo(DD[math.random(1,#DD)].CFrame)
		elseif Player.TeamColor == BrickColor.new("Bright green") then
			Player.Character:MoveTo(GG[math.random(1,#GG)].CFrame)	
		end
		if Player.Lethals ~= nil then
			local children = Player.Lethals:GetChildren()
			for i = 1, #children do
 				children[i].Value = 2
			end
		end
	end
end

1 comment

0

Your error isn't in this script. Check out the script called 'Fix' that gets added to the player's character.

2 answers

The error suggests that there is nothing called "Teleportedd" in the player. Is it a spell error?

Well not sure what your trying to do here but if your trying to move players around inside your game just do something like:

Player.Character.Torso.Position = CFrame.new(math.random)

Not sure about the math.random part as I myself have never used it but I have used something very similar to teleport a player.

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