You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
to show the uptime server time in how many players are on the server -
What is the issue? Include screenshots / videos if possible!
I’m trying to make a server status part where it shows the server uptime in how many players are on the server but it’s not working
hers my client script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local updateServerStatsEvent = ReplicatedStorage:WaitForChild("UpdateServerStatsEvent")
local serverTimeLabel = script.Parent:WaitForChild("serverTime"):WaitForChild("num")
local playerCountLabel = script.Parent:WaitForChild("players"):WaitForChild("num")
updateServerStatsEvent.OnClientEvent:Connect(function(serverTime, playerCount)
serverTimeLabel.Text = "Server Time: " .. serverTime
playerCountLabel.Text = "Player Count: " .. playerCount
end)
and here’s my server script
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UpdateServerStatsEvent = ReplicatedStorage:WaitForChild("UpdateServerStatsEvent")
local startTime = os.time()
local function updateServerStats()
local currentTime = os.time()
local elapsedTime = currentTime - startTime
local minutes = math.floor(elapsedTime / 60)
local seconds = elapsedTime % 60
local serverTime = string.format("%02d:%02d", minutes, seconds)
local playerCount = #Players:GetPlayers()
UpdateServerStatsEvent:FireAllClients(serverTime, playerCount)
end
while true do
updateServerStats()
wait(1)
end