I am trying to make a player count script but it won’t display the player count like it’s still 0 even if i join the game
the script :
while wait() do
script.Parent.Value = #game.Players:GetChildren()
end
This is what happens when I launch the game
the location of the script
the value properties
3 Likes
try doing script.Parent.Value = #game.Players:GetPlayers()
Or you could just add to the value when a player joins and minus when a player leaves
1 Like
while true do
script.Parent.Value = #game:GetService("Players"):GetPlayers()
task.wait()
end
1 Like
I’ve tried the two solutions, it did not work somehow
1 Like
It’s still not working
But i think i know where the problem is
I think the script works but the value isn’t updating to the player count
1 Like
ianplus
(ianplus)
October 27, 2023, 10:37am
#6
local nv = script.parent
game.Players.PlayerAdded:Connect(function()
nv.Value+=1
end)
game.Players.PlayerRemoving:Connect(function()
nv.Value-=1
end)
1 Like
Ok i’ve got the solution
Somewhat ReplicatedStorage doesn’t allow server scripts / Local scripts to run, like only module scripts can run in ReplicatedStorage
So I moved the script in ServerScriptService
But thanks for y’alls help
2 Likes
system
(system)
Closed
November 10, 2023, 10:40am
#8
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.