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

Character teleporting not working?

Asked by 1 year ago
local TeleportService = game:GetService("TeleportService")

local elevatorpos = script.Parent.Elevator.Union.Attachment.Position

local function yield()
    for i=15, 0, -1 do

    end
end

local function tp(otherpart)
    if not otherpart.Parent:FindFirstChild("Humanoid") then return end
    otherpart.Parent.HumanoidRootPart.CFrame = CFrame.new(elevatorpos)
    print(elevatorpos, "attachment")
    print(otherpart.Parent.HumanoidRootPart.Position)
end

script.Parent.Hitbox.Union.Touched:Connect(tp)

For some reason the player keeps getting teleported to what seems to be the origin (0,0,0) Even though when I print the position it should be correct. This is all from a serverscript inside a model inside workspace

0
Instead of moving their humanoid rootpart get their character and use :MoveTo() asmetics 26 — 1y

2 answers

Log in to vote
1
Answered by 1 year ago

otherpart.Parent should be the Player's Character model. If so, then you can use:

otherpart.Parent:MoveTo(elevatorpos.CFrame) or otherpart.Parent:MoveTo(elevatorpos)

Ad
Log in to vote
1
Answered by 1 year ago

You should have another part where the player teleports to not just put the location where the player teleports to.
Here is an example of one that I have made: My Model

0
Untrue, but I fixed it myself by using MoveTo rather than setting CFrame Kingu_Criminal 205 — 1y

Answer this question