New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How to rotate a model to face a position?

Asked by 8 days 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 kingdom5 5449 — 8d
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 75 — 8d
0
The wiki explains nothing good about how to use that CFrame.fromMatrix bruh wilsonsilva007 339 — 6d

Answer this question