So i have a problem with a error saying “Attempt to index nil with “FindFirstChild”.” even though i followed a tutorial and even tried copying the script in description, but the problem is still there.
I don’t know why it doesn’t work, but i assume that the player variable in the function is not actually player, but instead just a regular variable called “player”.
Here is the problematic part of the module script :
function PlayerManager.GetCash(player)
local leaderstats = player:FindFirstChild(“leaderstats”)
if leaderstats then
local Cash = leaderstats:FindFirstChild(“Cash”)
if Cash then
return Cash.Value
end
end
return 0
end
And here is the link to the tutorial i followed : https://www.youtube.com/watch?v=_63TM15fF1g&list=PLXSd5YZgxaXRMUSWybIRkELeIQLXJNZM7&index=4&ab_channel=BRicey
I will appreciate any help!