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

Teleporting NPCs to seatparts?

Hi there!

I'm trying to teleport NPCs to a seatpart, however they kinda fall as they are sitting: http://prntscr.com/dde5ru

folder[ai] is the NPC and part is the part which is the parent of the seatpart.

local part = chairpart
folder[ai]:SetPrimaryPartCFrame(part.CFrame)

I currently just use this code and play a sitting animation (the sit value in the humanoid is changed automatically).

I also have the seatpart unanchored and use welds as I know that can cause problems.

Any help would be appreciated! Thanks!

1 answer

I think I have the answer to your problem. Instead of using SetPrimaryPartCFrame, use Torso.CFrame (Or UpperTorso.CFrame if R15). Your code should now look like this.

local part = chairpart
folder[ai].Torso.CFrame = CFrame.new(part.CFrame)

OR if R15:

local part = chairpart
folder[ai].UpperTorso.CFrame = CFrame.new(part.CFrame)

Also, seats can be anchored and not glitch (in a new ROBLOX update.)

Hope this helped!

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