So I’m just trying to have a serverscriptservice script check how many players are in a server. If there is 1, the playmode value in replicatedstorage gets set to 1. If there is more then 1, the playmode value in replicatedstorage gets set to 2. This is so I can disable certain gui elements. But I can’t figure out how to do it or what I’m doing wrong. I’ve gone through different older forum posts and videos but none have worked.
local Players = game:GetService('Players')
local PlayerInServer = #Players:GetPlayers()
local playmode = game.ReplicatedStorage.Playmode.Value
if PlayerInServer == 1 then
playmode = 1
print("There is 1 Player, this is Singleplayer.")
elseif PlayerInServer > 1 then
playmode = 2
print("There is more then 1 Player, this is Multiplayer.")
end