So I have a part of my game where one of the NPCs turns around to look at the player during a dialogue sequence, but I want the NPC to turn around for each player who enters the sequence. When I tried to tween the NPC’s orientation in a local script, it didn’t work. How do I work around this?
Please feel free to ask for screenshots of my code/game, though be warned I’m still fairly new to scripting.
use task.wait(1), not wait(1). wait() is deprecated and shouldn’t be used.
Tween the CFrame, not Orientation, and then make sure the NPC’s Network Ownership is set to the client who is tweening it. What’s probably happening is the physics/replication engine on the server is keeping the NPC at its intended location. Here’s a document on Network Ownership.
You’re setting it to 0,0,0 positionally, the property is not an adjustment, its the actual value.
Al;so, given this is an NPC, you actually need to tween a CFrameValue instance and then use its .Value to call NPC:PivotTo(CFrameValue.Value) per heartbeat, as you cannot tween a Model’s CFrame (it has none)