#How do I make someone stop moving when a non-player humanoid is near me?

9 messages · Page 1 of 1 (latest)

grand oar
#

I have a script:
local char = script.Parent

local bodyvelocity = Instance.new("BodyVelocity")
bodyvelocity.MaxForce = Vector3.new(0, 0, 7500)
bodyvelocity.Velocity = Vector3.new(0, 0, -150)
bodyvelocity.Parent = char.HumanoidRootPart

(StarterCharacterScripts)

which forces a player to walk forwards, however I get an issue that it keeps walking into humanoid which messes up the angle, how do I make it so it stops when a humanoid is within a 20 stud radius. And how do I make it if it's dead the player will continue moving again?

hot talon
#

instead of the third line

#

but for making the player stop moving when approaching you could create an invisible part, which would be a hitbox, and make this script into it

shell eagle
#

wtf

hot talon
#
local part = script.Parent
local NPC = --your npc goes here
part.Touched:Connect(function(hit)
  if(hit.Parent:FindFirstChild("Humanoid")) then
    if not(hit.Parent == NPC) then
      hit.Parent.Humanoid.WalkSpeed = 0
      wait(3)
      hit.Parent.Humanoid.WalkSpeed = 16
    end
  end
end)
#

well that's an idea

grand oar
#

thank you