How would I change leaderstats values/values in the player inside of a LocalScript? The values change but only for the player, not for the whole server. How would I make them change for the whole server (i.e. a Shop GUI script). Here's part of my current shop GUI:
LOCAL SCRIPT
local cost = 100
local buyButton = script.Parent
local deb = false
local plr = game.Players.LocalPlayer
function purchasedText()
if buyButton.Parent.itemOwnedValue.Value == true then
buyButton.Parent.ImageColor3 = Color3.new(46/255, 213/255, 115/255)
buyButton.Parent.buyButton.Text = "Bought"
end
end
purchasedText()
buyButton.MouseButton1Down:connect(function()
deb = true
if plr.leaderstats.Money.Value >= cost and buyButton.Parent.itemOwnedValue.Value == false then
plr.leaderstats.Money.Value = plr.leaderstats.Money.Value - cost
buyButton.Parent.itemOwnedValue.Value = true
plr.danceFolder.idkDance.Value = true
script.Parent.Parent.ImageColor3 = Color3.new(46/255, 213/255, 115/255)
script.Parent.Parent.buyButton.Text = "Purchased"
elseif buyButton.Parent.itemOwnedValue.Value == true then
buyButton.Text = "Already Owned!"
wait(1.25)
buyButton.Text = "Bought"
elseif plr.leaderstats.Money.Value < cost and buyButton.Parent.itemOwnedValue.Value == false then
buyButton.Text = "You need "..cost - plr.leaderstats.Money.Value.. " more Money to buy this!"
wait(1.5)
buyButton.Text = "Buy"
end
deb = false
end)
It makes the value in dancesFolder true, but only for the player, not the server. How would I make that value change replicate to the server? (FE Enabled)

5 comments
Is there any way I would be able to efficiently do this for multiple players?
This should work just fine for multiple players as it is
Oops, I didn't mean players, I meant GUIs.
(Multiple of the same GUI)
(I.e. a shop GUI, different items so different costs but same GUIs)