How do I grab a player's point value using a button?
Asked by
4 years ago Edited 4 years ago
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
01 | script.Parent.MouseButton 1 Down:Connect( function () |
03 | local plr = game.Players.LocalPlayer |
05 | if plr.Points.Value > = cost then |
07 | plr.Points.Value = plr.Points.Value - cost |
09 | local pet = petModule.chooseRandomPet() |
11 | print (pet.Name.. " selected" ) |