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

How to fix attempt to index nil with 'leaderstats'?

Asked by 2 years ago

So this is my script and I'm very new to coding and don't know what to do

local part = game.Workspace.strengthpart
part.Touched:Connect(function(hit)
    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    local strength = player.leaderstats.strength.Value 
    local amount = 10
    local timeremove = 3
    strength = strength + amount
    wait(timeremove)
    strength = strength - amount
end)

and it the error it returns with is Workspace.strengthpart.Script:4: attempt to index nil with 'leaderstats' and no this isnt my script

0
Can u give me the script that u use to make "strength" Value?I think the problem is in that script lamgogo 56 — 2y

Answer this question