Hi! I’m looking for help on making an NPC turn and face a specific direction when a button is clicked.
For example:
NPC is called NPCA
and once a button is clicked, NPCA will now have a different orientation and be facing another direction. I’m looking to make it turn smoothly and so it doesn’t just teleport to face a new directon.
I’ve tried to use tweenservice to change it’s orientation but it’ll end up just moving the HumanoidRootPart or one part within the NPC and not the whole NPC.
I have not tested it but it might work:
Make a part and make it face a direction and name it for example X for the X direction Z for the Z direction. Then make your buttons. Make ALL the parts face it’s name so Z would look at the Z axis.
local direction = workspace.Z
local NPCA = workspace.NPCA
button.MouseClick:Connect(function()
if button.Name == "Z" then
NPCA.PrimaryPart.CFrame.lookVector = direction.lookVector
end
end)
Hi! I had the clickdetector etc previously set up but I’m getting an error… did I remove a important line of script or? I think I’ve give the location of everything needed etc? (All is in workspace etc…)