Skinstashery
Roblox
Home / Roblox / Studio script library / Speed boost pad
RB-004

Roblox speed boost pad script

A pad that makes a player run faster for a few seconds.

Script type
Script
Where it goes
Inside the Part
Category
Hazards and pads

For your own game in Roblox Studio. Not for use in other people's games.

The code

-- Speed boost pad: faster walking for a short time.

local BOOST_SPEED = 40    -- the normal WalkSpeed is 16
local DURATION = 5        -- seconds the boost lasts

local part = script.Parent
local boosted = {}        -- humanoids that already have a boost running

part.Touched:Connect(function(hit)
	local humanoid = hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid")
	if not humanoid or humanoid.Health <= 0 then
		return
	end
	if boosted[humanoid] then
		return
	end

	boosted[humanoid] = true
	local originalSpeed = humanoid.WalkSpeed
	humanoid.WalkSpeed = BOOST_SPEED

	task.wait(DURATION)

	if humanoid.Parent then
		humanoid.WalkSpeed = originalSpeed
	end
	boosted[humanoid] = nil
end)

How to set it up

  1. Insert a Part and set its Anchored property to true.
  2. Add a Script inside the Part.
  3. Paste the code.
  4. Play and step on the pad. You should run faster for 5 seconds.

Change it

More in Hazards and pads

All Roblox scripts

More Roblox tools