RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"can you make a walking npc but as soon as he hears gunshots he will run and panic"
-- server script local pfs = game:GetService("PathfindingService") local dummy = game.Workspace.Dummy local part = game.Workspace.MoveToPart local path = pfs:CreatePath() local gunshotSound = game.Workspace.GunshotSound local function panic() dummy.Humanoid.WalkSpeed = 50 dummy.Humanoid.Jump = true wait(1) dummy.Humanoid.Jump = false dummy.Humanoid.WalkSpeed = 16 end gunshotSound.SoundPlayed:Connect(panic) path:ComputeAsync(dummy.HumanoidRootPart.Position, part.Position) for _, waypoint in pairs(path:GetWaypoints()) do dummy.Humanoid:MoveTo(waypoint.Position) dummy.Humanoid.MoveToFinished:Wait() end