Why My Script Doesnt Work?

Hello Devs, i was doing a script to give speed to the Humanoid, everything is ok with my script, it works but the problem is when the script execute for the 2nd time, the script doesnt work for the 2nd time but the output doesnt give any errors, anyone know why this is happening?

Im doing this by touched event

My script:

local instance = script.Parent

local function speed(Part)
local Humanoid = Part.Parent:FindFirstChild(“Humanoid”)
if Humanoid then
Humanoid.WalkSpeed = 35
end
end
instance.Touched:Connect(speed)

1 Like
local instance = script.Parent

local function speed(Part)
   local Humanoid = Part.Parent:FindFirstChild(“Humanoid”)
   if Humanoid then
      Humanoid.WalkSpeed = 35
   end
end

instance.Touched:Connect(speed)

This is just a formatted version of his code.

3 Likes

It worked! Thanks.

I also have a question, why this happen?

Simple explanation here.
Setting 35 where it was 35.

1 Like

Uh, what?

That’s just a formatted version

Their script probably wasn’t formatted correctly lol

Oh lol

30 minimum