Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way to rotate a dummy to look directly at you?

Let's say i wanted to rotate the dummy's entire body to look towards the player's HumanoidRootPart is there a way to rotate the dummy's HumanoidRootPart in a loop?

1 answer

✓ Accepted answer

We can change the CFrame of the dummys HumanoidRootPart. There is a constructor of CFrame that lets us create a CFrame that is at position a and looks at position b. It is CFrame.new(Vector3 a, Vector3 b)

https://developer.roblox.com/en-us/api-reference/datatype/CFrame

local dummy = script.Parent
local dummyHRP = dummy.HumanoidRootPart

local lookAtPart = nil -- this is a BasePart that we would like to look at 

lookAtPart:GetPropertyChangedSignal("Position"):Connect(function()
	dummyHRP.CFrame = CFrame.new(dummyHRP.CFrame.Position, lookAtPart.Position)
end)

4 comments

0

Does this work in a localscript if i modify the values correctly?

0

Yes, but the position of the dummy would not replicate to the server.

0

That's exactly what i'm going for, thanks!

0

Please mark my answer as correct if it helped you.

This discussion is preserved as it was. New answers, comments, and votes are closed.