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

Error:attempt to index local 'part' (a nil value). Help?

Asked by 4 years ago

I'm pretty new to scripting and I'm having a problem:

local speedBoost = script.Parent

local function steppedOn(part)
    **local parent = part.Parent**
    if game.Players:GetPlayerFromCharacter(parent) then
        parent.Humanoid.WalkSpeed = 100
        wait(10)
        parent.Humanoid.WalkSpeed = 16
    end

end
speedBoost.Touched:Connect(steppedOn())

The Error: ** 13:54:39.433 - Workspace.Power-Up.Script:4: attempt to index local 'part' (a nil value)**

I have no idea how to fix it.

I don't know if its just that part I need to fix or I just suck at scripting.

Any Ideas?

0
get rid of the () after SteppedOn on line 12 theking48989987 2147 — 4y
0
if those parenthesis are there, you are essentially connecting the returned value from SteppedOn to the event theking48989987 2147 — 4y
0
theking48989987 THANK YOU Drek_Bop2002 5 — 4y

Answer this question