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

Won't tp to right place?

Asked by 8 years ago
local player = game:GetService("Players").LocalPlayer
mouse = player:GetMouse()
   mouse.Button2Down:connect(function()
player.Character:MoveTo(Vector3.new(mouse.Hit.p))

end)

It takes me to where I spawn, and it only teleports there and infront a little. I have no idea why, no errors, Local Script in backpack (Starterpack)

0
Have you tried adding to the vector3? EX. player.Character:MoveTo(Vector3.new(mouse.Hit.p + Vector3.new(0,1,0))) would add 1 to the y axis. yogipanda123 120 — 8y
0
Nope fireboltofdeath 635 — 8y

1 answer

Log in to vote
2
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
8 years ago

You're basically doing

Vector3.new( Vector3.new() )

which is obviously flawed. mouse.Hit.p is already a Vector3, so just use it;

player.Character:MoveTo(mouse.Hit.p)

Just remember that when Roblox transfers a 2D mouse into 3D space, the result is often not what you want, so something extra or different may have to be done.

0
Thank you fireboltofdeath 635 — 8y
Ad

Answer this question