This post is old and no longer being updated.
I’m not 100℅ sure too but this is what i recommend. Add a print within your button.Activated connection to see if its multi-firing. Print the counter value on the client within the updatePlayerCount. Lastly, please remove the waits within the event in your serverscript they server no purpose. Also, print “counterValue.Value” on the server
When you fire updatePlayerCount on the server just change the counter on the client
Now it seems to be doing this:
Its a two player only server right?
Yeah. I have no other servers that allow for more or less players.
A different approach that will 100% work.
- Set attribute under replicated storage
- Update this on the server
The code below is in a script under a text label. If in a serverscript you switch this attribute it will update to all players. You can change this code so It fits your script.
local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
RS:GetAttributeChangedSignal("ReadyPlayers"):Connect(function(...: any)
local ReadyPlayers = RS:GetAttribute("ReadyPlayers")
local TotalPlayers = #Players:GetPlayers()
local Str1, Str2 = tostring(ReadyPlayers), tostring(TotalPlayers)
script.Parent.Text = Str1.. " / "..Str2
end)
This line is accessing a Counter unique to each player, not shared.
If that was someplace like; workspace.data.Counter they would share it.
So if I were to make a global value on the server, would the counter update through all player’s respective Guis?
Maybe … I just use data on the workspace. Don’t see why what you said wouldn’t workout.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.