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

How do I teleport a model to a player's head?

Asked by 5 years ago

This is what I tried but the model teleports to a place It cannot be found

local glider = game.Workspace.DefaultGlider:Clone()
wait (2)
glider:MoveTo(Vector3.new(game.Players.LocalPlayer.Character.Head.CFrame *  CFrame.new(0,5,0)))

3 answers

Log in to vote
4
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
5 years ago

Thing is: You can't a construct a Vector3 with a CFrame, and you haven't set the parent of the glider

Also, I recommend using SetPrimaryPartCFrame, since MoveTo has collision detection and will position the part above a part, if a part is in the way.

You should note that SetPrimaryPartCFrame can only be used when the Primary part is set, else it'll error. You should preset it in studio

local glider = workspace.DefaultGlider:Clone()
wait(2)
glider:SetPrimaryPartCFrame(game.Players.LocalPlayer.Character.Head.CFrame * CFrame.new(0, 5, 0))
glider.Parent = workspace
1
Great answer! RAYAN1565 691 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

I recommend Using 'Cframe.new' instead of 'Vector3.new'

If that model is supposed to be a ncp then use their torso with

torso.CFrame = CFrame.new(X,Y,Z)
Log in to vote
0
Answered by
Troxure 87
5 years ago
local glider=workspace.DefaultGlider:Clone();
wait(2)
glider:MoveTo(game.Players.LocalPlayer.Character.Head.Position+Vector3.new(0,5,0));

Try this

Answer this question