Skip to main content

Getting Started with OpenNPC

Install the library via Pesde:

pesde install openfeline/opennpc

Usage

Creating an NPC

local OpenNPC = require(path.to.OpenNPC)

local npc = OpenNPC.new(
npcModel,
rig,
16 -- walk speed (studs/sec)
)

Moving an NPC

npc:MoveTo(Vector3.new(0,0,0))
npc:MoveTo(Vector3.new(20, 0, 10), 10) -- higher priority

Listening for Movement Completion

npc.MoveToFinished:Connect(function()
print("NPC finished all movement")
end)

State Changes

npc.StateChanged:Connect(function(state)
print("New state:", state)
end)

Playing Animations

local walk = NPCController:LoadAnimation({
alpha = 0,
looped = true,
priority = 1,
stop_fade_time = 1,
start_fade_time = 1,
weight = 1,
}, ReplicatedStorage.animations.Walk)

walk:Play()