RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a script inside a NPC Model that plays a sound when an NPC walks"
-- local script inside NPC model local NPC = script.Parent local humanoid = NPC:WaitForChild("Humanoid") local walkingSound = NPC.Head:WaitForChild("WalkingSound") local function playSound() if humanoid.MoveDirection.Magnitude > 0 then if not walkingSound.IsPlaying then walkingSound:Play() end else if walkingSound.IsPlaying then walkingSound:Stop() end end end humanoid.Running:Connect(playSound)