Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is this teleporting script not working?

Asked by 8 years ago

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
0
Your error isn't in this script. Check out the script called 'Fix' that gets added to the player's character. iconmaster 301 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

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

Ad
Log in to vote
0
Answered by 8 years ago

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.

Answer this question