I was modding a script from "Art of parkour" and I was trying to give the player AirCoins every time they wall jump, but the error says:
Players.(the player).Backpack.KeyBindings:34: attempt to index local 'plr' (a nil value)
and the script goes like this:
player.Character.InteractPart.Touched:connect(function(part) if part.CanCollide == true then wallJumpReady = true mouse.KeyDown:connect(function(key) key = key:lower() if key:byte() == 32 and wallJumpReady == true then local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent) plr.leaderstats["AirCoins"].Value = plr.leaderstats["AirCoins"].Value + 1 torso.Velocity = torso.CFrame.lookVector * 50 + Vector3.new(0,80,0) wallJumpReady = false end end) part.TouchEnded:connect(function(torsoPart) if torsoPart == player.Character.InteractPart then wallJumpReady = false end end) end end)
Please help!