Need help with teleportation script (basic)

  1. This script was intended to teleport players to their own brick

  2. no errors displayed ~ it doesn’t work ~ it just teleports the player to 0,0,0,0

  3. I’ve looked on deev hub and couldn’t find any solutions I even asked in discord for solutions


    game.Players.PlayerAdded:Connect(function(plr)
        wait(1)
        local S = spawns.SpawnObject
        plr.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(S.Position))
        S.Name = plr.Name
        plr.Character.Humanoid.Died:Connect(function()
        plr.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(-3279.922, -4.125, 26.54))
        end)
    end)

Could Anynody Help?

CFrame is already a 3d position. So you don’t need Vector3 in there too.

You can make a part and make it face somewhere and tp the player to that parts’ cframe, Which makes the player face the parts forward face.

local spawns = game.Workspace.Spawn

game.Players.PlayerAdded:Connect(function(plr)
    wait(1)
    local S = spawns.SpawnObject
    plr.Character.HumanoidRootPart.CFrame = S.CFrame
    S.Name = plr.Name
    plr.Character.Humanoid.Died:Connect(function()
    plr.Character.HumanoidRootPart.CFrame = CFrame.new(-3279.922, -4.125, 26.54)
    end)
end

If plr.Character.HumanoidRootPart.CFrame = S.CFrame does not work, try SetPrimaryPartCFrame, for example:

plr.Character:SetPrimaryPartCFrame(S.CFrame)

If that doesn’t work, check the positioning of your SpawnObject and make sure that it’s correct. Also, confirm that nothing else could be interfering with the process.

1 Like

thanks for replying!
this is my code so far

it still didn’t work tho :frowning:

as seen in this video

thanks for replying!
this is my code so far

it still didn’t work tho that’s pretty sad :frowning:

I still understand your point

as seen in this video

the positioning is good and nothing is coliding
im just really confused lol

OMG im so sorry XD

i didn’t anchor the parts a very stupid mistake

im so so sorry lmao