local player = game.Players.LocalPlayer local character = player.Character script.Parent.MouseButton1Click:Connect(function() character.LowerTorso.Position = Vector3.new(-51.185, 6.295, 17.411) end)
it separates my lower torso from my character and it goes flying and i can't move.
Try teleporting the HumanoidRootPart
instead.
Hello! Hope you're having a great day :D
I see you're struggling to move the player's position, and I'd personally recommend you use CFrame
this is a very powerful property as it stores everything about a part, position, rotation, size, etc.
Also to move the player you'd want to teleport it by it's primary part which is usually HumanoidRootPart
So in your script, this is how we would implement it:
First, you will want to put a part where you want the player to teleport.
Then in the console at the bottom of your studio input the below command:
print(game.Workspace["YOUR PART HERE"].CFrame.Position)
The output will look like so:
100, -50 ,100
Now that we have that we can do this:
local player = game.Players.LocalPlayer local character = player.Character local tpCFrame = CFrame.new(100, -50, 100) -- our location script.Parent.MouseButton1Click:Connect(function() character.HumanoidRootPart.CFrame = tpCFrame -- changed the part to the rootpart, and used cframe instead of vector3 end)
I hope I was able to help you today :D
Thanks for reading, - DrShockz
When teleporting, you need to reference the HumanoidRootPart
, rather than the LowerTorso
.
It's also necessary to do this activity in a Server Script
.
script.Parent.Touched:Connect(function(touched) if touched.Parent:FindFirstChild('Humanoid') then touched.Parent:MoveTo(Vector3.new(-10.5, 6, 16)) end end)