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

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

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

✓ Accepted answer

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"

2 comments

0

that worked so thank you

0

yw! pls accept this answer so many ppl can see it too

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