Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I give speed boost?

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago
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.

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? Megabear137 5 — 9y
0
Change line 06: "parent.Humanoid.Walkspeed = (whatever speed you want to set it to, maybe experiment)" Sharpthy 46 — 9y
Ad

Answer this question