Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make this add leaderstats GUI not local?

Asked by 5 years ago

I have made a button that allows a player to add value to a leaderstat named ChaseCoins. This works perfectly, except for the fact that only the player who added the value can see it. For example, if there were 2 people in a game, they couldn't see each other's changes to their stats. How would I make this not local?

local Player = game.Players.LocalPlayer
local Leaderstats = Player.leaderstats.ChaseCoins
local Box = script.Parent.Parent.Value

function me()
Leaderstats.Value = Leaderstats.Value + Box.Text
end

script.Parent.Activated:Connect(me)
0
You need to use Remote Events, everytime when you want to change a value and make it visible for all players on the server. Here for more information about Remote Events: https://developer.roblox.com/articles/Remote-Functions-and-Events iagometroid 61 — 5y
0
Would I make the remote event before hand, or would I "instance.new" it? ChasingNachos 133 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

You need a way for the local script to communicate with the server.

In this case, you will use remote events. https://developer.roblox.com/articles/Remote-Functions-and-Events

You can choose to spawn them in using instance.new if you wish. Put them in replicated storage for easy storage.

Ad

Answer this question