Scripting question with NPC Humaniods

Im trying to make it so that when an npc/enemy touches and effect (called “Fire”) its speed doubles. I only want this to work for one specific npc and not the player so I dont 100% know how I would do this. What should I do? Thx in advance.

2 Likes

You can try using a Touched event and change Humanoid.Walkspeed if the NPC’s name corresponds to a string. This part will be transparent and put over the fire.

1 Like

look at this. https://developer.roblox.com/en-us/api-reference/event/BasePart/Touched you have to make a part for it since fire can’t be physically touched and make it transparent with the fire ontop of it. change the humanoids walkspeed in the touched event https://developer.roblox.com/en-us/api-reference/property/Humanoid/WalkSpeed

local currentWalkspeed = 16
script.Parent.Touched:Connect(function(hit)
   if hit.Parent.Humanoid then
          local newWalkspeed = currentWalkspeed * 2
          script.Parent.Humanoid.Walkspeed = newWalkspeed
          currentWalkspeed = newWalkspeed
   end
end)