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

Character teleporting not working?

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

1 comment

0

Instead of moving their humanoid rootpart get their character and use :MoveTo()

2 answers

✓ Accepted answer

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)

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

1 comment

0

Untrue, but I fixed it myself by using MoveTo rather than setting CFrame

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