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

How to rotate a model to face a position?

Asked by 4 years ago

So I wanna rotate a part of a model to face the position of another part. I have tried the following script, but it always return the error Argument 1 missing or nil..

How would I go about fixing this?

Here's the line of code I have that's suposed to rotate it:

script.Parent.Top:SetPrimaryPartCFrame(script.Parent.Top.PrimaryPart.Position, game.Workspace:FindFirstChild(Target).HumanoidRootPart.Position)

Note: "game.Workspace:FindFirstChild(Target).HumanoidRootPart.Position" is the position the model is supposed to look at.

Any help is appreciated!

Thanks!

0
Target is nil User#5423 17 — 4y
0
Look at the wiki here: https://developer.roblox.com/en-us/api-reference/datatype/CFrame#functions What you want is the 2nd CFrame.new(), or CFrame.fromMatrix dualworlds 90 — 4y
0
The wiki explains nothing good about how to use that CFrame.fromMatrix bruh wilsonsilva007 373 — 4y

Answer this question