New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 8 months 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 2120 — 8mo
0
if those parenthesis are there, you are essentially connecting the returned value from SteppedOn to the event theking48989987 2120 — 8mo
0
theking48989987 THANK YOU Drek_Bop2002 5 — 8mo

Answer this question