Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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.

12 comments

0

you are changing the values on the client, change it on the server.

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.

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?

0

Oh srry i didnt see the message because i didnt refresh the page, and thank you for the help

0

instead of localplayer, use the player parameter inside your function

0

in your onPlayerJoin function, you have the player parameter. just use that!

0

^ do what gio said lol

0

Yeep, Local scripts are for local client things and normal scripts are for the server stuff thing thing stuff (I can't type)

0

its ok we all appreciate ur service gamergirl

0

Yeah lol i had figured the problem was it being a local script

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

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

1 answer

✓ Accepted answer

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.

2 comments

0

parameter you mean?

1

Yes my bad

This discussion is preserved as it was. New answers, comments, and votes are closed.