Dummy won't rotate more than 180°

hey,
I’m making a script that after the dummy has walked to a place, it will fix it’s rotation to watch the table.
I’ve tried searching a round a way to help me, but sadly found none.

Sadly the following part of the script doesn’t work as wanted.
I’ve tried putting the following values(0,90,180,270,360,20,35,210,178), but the dummy won’t rotate more than 90 degrees.
Only the values < 90 will rotate it to the right value, all the ones after 90 will just put it at 90°, not more.
The desired value would be 180 if it worked.

local originalCF = Clone:GetPrimaryPartCFrame()
Clone:SetPrimaryPartCFrame(CFrame.new(originalCF.Position,Vector3.new(180,0,0)))

Thank you all!

5 Likes

I’d recommend using :GetPivot() and :SetPivot(), as they’re newer.

4 Likes

Tried using them but :SetPivot() doesn’t work, so i found out about PivotTo().
Sadly that gives the same result, not an agle more than 90° degrees.

2 Likes

Ah, I see the problem.

You’re setting its pivot in world instead of local; the Vector3.new(180,0,0) is just the center of the world with its X moved to 180.

So maybe set the position to where you want the dummy to look at.

5 Likes

As @SageToxigen said, there’s a difference between ObjectSpace and WorldSpace.
Here’s a link explaining it. Object and World Space | Documentation - Roblox Creator Hub
Also CFrames don’t recognize anything below and above 180 for Orientation. As you can tell by looking at objects in the workspace they are all -180 to 180 degrees.

4 Likes

I must be honest, i don’t understand what i have to do…

2 Likes

It’s actually simple, just set the position to where you want the dummy to face to, like this:

local FacingDirection = Vector.new(0, 0, 0) -- The WorldSpace position you want the dummy to face to

local originalCF = Clone:GetPivot()
Clone:SetPivot(CFrame.new(originalCF.Position, FacingDirection))
3 Likes

Thank you a lot, tho the log tells me that “SetPivot()” is not a valid member of model?

Oops, I got it wrong, it’s :PivotTo(), I believe

1 Like

Thank you a lot! @SageToxigen
Thank to you too for explaing that to me @Scottifly

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.