Teleport local script teleports the player back to original spawn point after being teleported?

Literally what the title says, I have a platform with the spawn point where the player will spawn when they join the game (with a black screen, since they’re not supposed to see the platform), and after 3 seconds they’d be teleported to a room.

The problem is, after the player is teleported, it gets brought back to the spawn point??? Here’s a vid of what i mean

As you can see, I DO get teleported to the room but a split second later I get teleported back? What the heck is going on here? I have used this exact same method of teleporting the player on other games and it’s always worked perfectly. This is the script
image

Edit: i also tried using the Torso instead of HumanoidRootPart, same thing happened

Try putting a player.CharacterAdded:Wait(), might work

Hi, where do I put it? I tried putting it before the “local char” variable, after the local char variable, and also replaced the variable to be local char = player.CharacterAdded:Wait() and the script just stops running when it gets to the CharacterAdded line

replace local char part to local char = player.Character or player.CharactedAdded:Wait() and tell me what happens

Still getting teleported back to the spawn point, nothing changed

Side note, but please do not use wait(x) within your script as that is now deprecated and should be replaced with task.wait(x) instead

Consider adding your variables at the start of your script first before following onto them, also this might be due because you’re teleporting the Character Model from a LocalScript, try adding another script inside ServerScriptService using the PlayerAdded & CharacterAdded Events like so:

local Plrs = game:GetService("Players")
local PartToTP = workspace:WaitForChild("teleportafterspawn")

Plrs.PlayerAdded:Connect(function(Plr)
    Plr.CharacterAdded:Connect(function(Char)
        task.wait(3.5)
        Char:SetPrimaryPartCFrame(PartToTP.CFrame)
    end)
end)
-- LocalScript
local UI = script.Parent

task.wait(.5)
UI.Frame.Visible = true
task.wait(3)
UI.Frame.Visible = false
1 Like

Hi, thanks, your script worked! However, I noticed the true reason why the character kept getting teleported back…

Turns out, the room was way too low in the map that it was basically in the “void” zone where roblox just kills your character when you get there, and I made it that you respawn instantly, so I just lowered the void height in workspace properties and I fixed it! I don’t know why, but your script actually helped me figure it out as when testing it out, instead of dying instantly and respawning, I saw the red vignette in the screen and realized what the issue was!