I am trying to make a little leaderstats instance and what I'm doing is making it so that when you click an on screen button it will give you 25 points. So how would I go about changing the value from a local script in a button? (I have FilteringEnabled btw)
✓ ANSWER ACCEPTED
How to change leaderstats value?
1 answer
✓ Accepted answer
Hello, ItsJamsRBLX!
Inside of the TextButton there should be a LocalScript. Inside of this script should be a FireServer event when they click the button. I will only be helping you with the script that controls when the remote is fired.
local Rep = game:GetService("ReplicatedStorage")
local Remote = Rep:WaitForChild("RemoteName")
Remote.OnServerEvent:Connect(function(player) -- this is called when the remote is fired; the argument inside of this is a way you can get the player. the first argument will always be the player
local PlayerStats = player:WaitForChild("leaderstats")
local PlayerCoins = PlayerStats.Coins
end)
Of course, you would have to modify this to your liking.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Can we see your code please.