[Solved] Attempt to index nil with leaderstats, how else can I get the leaderstats?
Asked by
4 years ago Edited 4 years ago
Hello! So I have this script in SSS that has to get the players money and subtract it. The script doesn't find leaderstats in the player. How would I correct this?
At first, I tried to get the player through game.Players.LocalPlayer but that doesn't work since it's in a regular script. Thanks for reading :)
1 | self.claimPart.Touched:Connect( function (touchedPart) |
2 | local player = game.Players:GetPlayerFromCharacter(touchedPart.Parent) |
3 | if player.leaderstats.Cash.Value > = self.COST then |
4 | if player and self.owner = = nil and self:ownsHouse(player) = = false then |