Speed Boost

Speed Boost

Where to put this script

Put this script inside the part that will activate the speed boost when touched

Script

local speedPart = script.Parent
-- Set a variable for boosted speed power
local SPEEED_POWER = 200
local function speed(otherPart)
    local partParent = otherPart.Parent
    local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
    if humanoid then
        local currentSpeed = humanoid.WalkSpeed
        if currentSpeed < SPEEED_POWER then
            humanoid.WalkSpeed = SPEEED_POWER
            wait(10)
            humanoid.WalkSpeed = currentSpeed
         end
    end
end
speedPart.Touched:Connect(speed)


Customize

How much boost

local SPEEED_POWER = 200