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

Other peoples leaderstats are only changing on their screen? It doesn't update for other people?

Asked by 5 years ago

Server side script that adds the leaderstats values:

local function onPlayerJoin(player)
    local leaderstats = Instance.new("Folder")
    leaderstats.Name = "leaderstats"
    leaderstats.Parent = player

    local wave = Instance.new("IntValue")
    local coins = Instance.new("IntValue")
    coins.Name = "Coins"
    wave.Name = "Wave"
    coins.Value = 0
    wave.Value = 1
    coins.Parent = leaderstats
    wave.Parent = leaderstats
end

game.Players.PlayerAdded:Connect(onPlayerJoin)

Local script that changes the leaderstats values based on what your Wave or Coins are:

local Update = true
local Wave = 1
local Coins = 100

local plrWave = game.Players.LocalPlayer.leaderstats.Wave
local plsCoins = game.Players.LocalPlayer.leaderstats.Coins

while Update == true do
    plrWave.Value = Wave
    plsCoins.Value = Coins
    wait(0.1)
end

So these scripts work fine and change the leaderstats values for the player, but not for other players, i feel like this has something to do with the script that changes the values being a local script, but if someone could help me it would be much appreciated.

0
you are changing the values on the client, change it on the server. piRadians 297 — 5y
0
transfer the code from the local script to the server script. it will work the same way on the server, except you'll be abiding by the rules of FilteringEnabled. Gey4Jesus69 2705 — 5y
0
Could you please explain how i would change it on the server instead of the client, like would i change it from game.Players.LocalPlayer to something else? Voidyll 8 — 5y
0
Oh srry i didnt see the message because i didnt refresh the page, and thank you for the help Voidyll 8 — 5y
View all comments (8 more)
0
instead of localplayer, use the player parameter inside your function piRadians 297 — 5y
0
in your onPlayerJoin function, you have the player parameter. just use that! Gey4Jesus69 2705 — 5y
0
^ do what gio said lol piRadians 297 — 5y
0
Yeep, Local scripts are for local client things and normal scripts are for the server stuff thing thing stuff (I can't type) User#24928 0 — 5y
0
its ok we all appreciate ur service gamergirl Gey4Jesus69 2705 — 5y
0
Yeah lol i had figured the problem was it being a local script Voidyll 8 — 5y
0
This didnt work, i changed everything over to the server sided script and made LocalScript into player but it doesnt change the value now Voidyll 8 — 5y
0
I should also say that i need to be able to change the value of Wave when a gui is clicked, not asking for the script, just saying thios because it might be affecting something, thopugh i dont have that part in the server sided script right now Voidyll 8 — 5y

1 answer

Log in to vote
1
Answered by
oftenz 367 Moderation Voter
5 years ago

You are attempting to change server sided elements on the client. Simply move your localscript into your server sided script. Change LocalPlayer to your argument, player.

0
parameter you mean? piRadians 297 — 5y
1
Yes my bad oftenz 367 — 5y
Ad

Answer this question