Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I give speed boost?

This script is supposed to give a speed boost whenever someone touches a giver that I made. Can someone tell me why it's not working?

local SpeedBoost = script.Parent

local function touched (part) 
	local parent = part.Parent
	if game.Players:GetPlayerFromCharacter(parent)then
		parent.Humanoid.Walkspeed = 21
	end
end

SpeedBoost.Touched:connect(touched)

1 answer

✓ Accepted answer
local SpeedBoost = script.Parent

local function touched (part) 
    local parent = part.Parent
    if game.Players:GetPlayerFromCharacter(parent)then
        parent.Humanoid.Walkspeed = parent.Humanoid.Walkspeed + [amount to boost each time]
    end
end

SpeedBoost.Touched:connect(touched)

If that doesn't work check if any errors are returned in the output.

2 comments

0

thank you. It works, but do you know how to make it that it only gives the boost the first time you touch it?

0

Change line 06: "parent.Humanoid.Walkspeed = (whatever speed you want to set it to, maybe experiment)"

This discussion is preserved as it was. New answers, comments, and votes are closed.