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 :)

	self.claimPart.Touched:Connect(function(touchedPart)
		local player = game.Players:GetPlayerFromCharacter(touchedPart.Parent) 
		if player.leaderstats.Cash.Value >= self.COST then -- this line errors
		if player and self.owner == nil and self:ownsHouse(player) == false then
			self.owner = player

1 comment

0

I guess the script needed :WaitForChild on line 3 after player. Nevermind :)