Hello! I will try to help you out.
If we try to change the value by pressing the button, no one else in the server will see it. Only the client will. To fix this, we first need to add a normal script/server script into wokspace. I will name mine Events Inside of that, insert a remote event. I will name mine AddCoins.
Inside the server script type:
script.AddCoins.OnServerEvent:Connect(function(player)
player.leaderstats.Coins.Value += 1000
end)
Very simple.
Now that we have done that, we can start coding the local script that you put in the button.
Just type:
local button = script.Parent
local player = game.Players.LocalPlayer
button.Visible = false
local staff = {
1842291423;
87326472;
}
for i, v in pairs(staff) do
if player.UserId == v then
button.Visible = true
end
end
button.MouseButton1Click:Connect(function()
game.Workspace.Events.AddCoins:FireServer()
end)
if you want everyone to have the button then remove the for loop, the if statement, and line 3 from the Local Script But if you just want certain people to have it, then leave it the way i have it above.
I hope I was able to help you out! If it did, please let me know and also accept this answer please. Let me know if you have any questions!
1 comment
Thanks! It worked!