I want to make a game where players run from a NPC which I am adding power-ups to. The only problem is that when a NPC touches it makes the NPC go faster when I want it to only make the player go faster
local hitBox = script.Parent.HitBox
local debounce = true
hitBox.Touched:Connect(function(hit)
if debounce == true then
debounce = false
local char = hit.Parent
if char:FindFirstChild("Humanoid") then
hitBox.Transparency = 1
hitBox.Parent.InnerCore.Transparency =1
char.Humanoid.WalkSpeed = 40
wait(2)
char.Humanoid.WalkSpeed = 30
hitBox.Parent:Destroy()
end
end
end)

2 comments
Change the variable NPC to whatever the NPC model is.