This might be a silly question, but im new to scripting so..
Anyways, I would like to learn how to teleport a whole player's body instead of only teleporting the HumanoidRootPart. Can anyone help me out, please? This is the script ive got for now:
script.Parent.ClickDetector.MouseClick:Connect(function() script.Parent.Parent.Parent.ACTUALTRAPDOOR.Yallo.Anchored = false script.Parent.Parent.Parent.ACTUALTRAPDOOR.Part.Anchored = false wait(2) script.Parent.Parent.Parent.ACTUALTRAPDOOR.Yallo.Anchored = true script.Parent.Parent.Parent.ACTUALTRAPDOOR.Part.Anchored = true script.Parent.Parent.Parent.ACTUALTRAPDOOR.Part.Orientation = Vector3.new(0, 180, 0) script.Parent.Parent.Parent.ACTUALTRAPDOOR.Yallo.Orientation = Vector3.new(0, 180, 0) script.Parent.Parent.Parent.ACTUALTRAPDOOR.Yallo.Position = Vector3.new(-3.8, 30.406, -89.23) script.Parent.Parent.Parent.ACTUALTRAPDOOR.Part.Position = Vector3.new(4.96, 30.406, -89.23) wait(2) game.Workspace.xDestinoYT.HumanoidRootPart.Position = Vector3.new(-0.58, 37.186, -89.94) end)
Instead of setting the Position you should set the CFrame so that collisions don't matter. If you move the HumanoidRootPart with CFrame, the rest should automatically be brought with it because of the joints. You should also get the player's character through Players instead of workspace (each player has a property called Character that points to the character model).
game.Players["xDestinoYT"].Character.HumanoidRootPart.CFrame = CFrame.new(-0.58,37.186,-89.94)
As well as this, instead of going script.Parent.Parent.ACTUALTRAPDOOR
every time, you can make a variable for it:
local trapdoor = script.Parent.Parent.Parent.ACTUALTRAPDOOR
And then you can refer to it like this:
trapdoor.Yallo.Anchored = false
Also, you can use CFrames to rotate the part too instead of Orientation:
trapdoor.Yallo.CFrame = CFrame.new(-3.8,30.406,-89.23) * CFrame.Angles(0, math.rad(180),0)