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

I want to make a PowerUp part but my script does not work. Why?

Asked by 5 years ago

This Script is Supposted to make my part give me (Or other player) powers. But when i run through it, i stay the normal speed and jump height.

--Variables
local PowerUp = script.Parent
local SpeedUp = PowerUp.SpeedUpAmount.Value
local JumpPower = PowerUp.JumpPowerAmount.Value
local Duration = PowerUp.Duration.Value
local CanTouch = true 

--Function script:
local function GivePowers(part)
    local hum = part.Parent:FindFirstChild("Humaniod")
    if hum and CanTouch then
        CanTouch = false
        local OriginalWalkSpeed = hum.WalkSpeed
        local OriginalJumpPower = hum.JumpPower
        hum.WalkSpeed = SpeedUp
        hum.JumpPower = JumpPower
        PowerUp.Transparency = 1.0
        wait(Duration)
        PowerUp.Transparency = 0.0
        hum.WalkSpeed = OriginalWalkSpeed
        hum.JumpPower = OriginalJumpPower
        CanTouch = true
    end
end

PowerUp.Touched:Connect(GivePowers)
0
Does it print out any errors? Sonnenroboter 336 — 5y
0
humaniod RegisteredCode 5 — 5y
0
u spelled humanoid wrong DEVLogos 8 — 5y
0
Thanks so much! Bssiemeow 30 — 5y

Answer this question