I am making a button that when you click on it, it subtracts the cost from your points and opens the egg so you get a pet, like in simulator games. My issue is that I am struggling to grab the players point value. Points are NOT displayed on the leaderstats, they are stored in the Player.
This is not a local script
script.Parent.MouseButton1Down:Connect(function()
local plr = game.Players.LocalPlayer
if plr.Points.Value >= cost then
plr.Points.Value = plr.Points.Value - cost
local pet = petModule.chooseRandomPet()
print(pet.Name.." selected")
end
end)

4 comments
you cant get the localplayer from a normal script
Do this function on a local script, then send a remote event to a script, and send the points value with it.
Where are the points stored? I'm assuming they are stored in the player?
The points are stored in the player