Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I rotate an npc model without using a primary part?

Asked by 2 years ago

I am trying to rotate a model when I teleport it so it faces a certain direction but I cannot find out how.

game.Workspace.Cabin.StartingCabin.FrontDoor.Door.Handle.ExteriorHandle.ProximityPrompt.Triggered:Connect(function(client)
    local Character = client.Character
    local Jikininki = game.Workspace.Jikininki
    Character:MoveTo(game.Workspace.TeleportPlayers.Position)
    Jikininki:MoveTo(game.Workspace.TeleportJikininki.Position)
    Jikininki.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(Jikininki.HumanoidRootPart.Position)) * CFrame.Angles(Vector3.new(0,30,0))
end)

I am getting the error Argument 3 missing or nil - Server - Script:6 I know I need three arguments for line 6 but I don't know what to do.

1 answer

Log in to vote
0
Answered by 2 years ago

Use Pivots.

local RotatingSpeed = 1 -- change this to whatever you like
local RotateCFrame = CFrame.Angles(0, math.rad(RotatingSpeed), 0) -- adjust this until you get the result you wanted

-- multiple lines of codes later..

npc:PivotTo(npc:GetPivot() * RotateCFrame)

Change the RotatingSpeed to whatever you like and adjust RotateCFrame until you get the result you wanted. X is for upwards/downwards, Y is for sideways (horizontal), and Z is for sideways (vertical).

Also if you still haven't got the result you wanted, I recommend editing the model's pivot. To do this, click on the NPC in the workspace, go to the Model Tab at the top of your screen, and click "Edit Pivot"

0
that worked so thank you preston86542279 7 — 2y
0
yw! pls accept this answer so many ppl can see it too T3_MasterGamer 2189 — 2y
Ad

Answer this question