My timer doesn't seem to work when I amke it server sided

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    Simply trying to get the billboard gui to increase +1 every second, essentially a stopwatch.

  2. What is the issue?
    Basically, when I do the billboard clientsided (script is below), the script works just fine but obviously only I the player can see when my billboard changes but I can’t see the other player’s billboards change.

Originial Script

image

local PlayerVals = script.Parent.Parent:WaitForChild("PlayerVals")
local Seconds = PlayerVals:WaitForChild("Seconds")

local RenderService = game:GetService("RunService")

script.Parent.TextLabel.Text = Seconds.Value

local TextLabel = script.Parent.TextLabel

local RS = game:GetService("ReplicatedStorage")
local Timer = RS:WaitForChild("Timer")

while wait(1) do
	Seconds.Value = Seconds.Value + 1
	TextLabel.Text = Seconds.Value

end

However, when I attempted to make it server sided it just didn’t work.

When I tried to make the script server sided it just stopped wokring, here it is below

Full Scripts
Server Script

image

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Timer = ReplicatedStorage:WaitForChild("Timer")



Timer.OnServerEvent:Connect(function(player, Seconds)
	
	local Timer = player:WaitForChild("Timer")
	local TextLabel = Timer:WaitForChild("TextLabel")
	
	Seconds.Value = Seconds.Value + 1
	TextLabel.Text = Seconds.Value
	
	
end)
Local Script

image

local PlayerVals = script.Parent.Parent:WaitForChild("PlayerVals")
local Seconds = PlayerVals:WaitForChild("Seconds")


script.Parent.TextLabel.Text = Seconds.Value

local TextLabel = script.Parent.TextLabel

local RS = game:GetService("ReplicatedStorage")
local Timer = RS:WaitForChild("Timer")

while wait(1) do
	Timer:FireServer(Seconds)
end

I’m quite new to scripting and stll don’t fully understand how server events work, any help would be appreciated.

You should probably make this not depend on 2 scripts, and instead only one.


timer = 0

for i = 0, math.huge, 1 do
timer += 1 -- or set this to i
end

Or change an IntValue or NumberValue by 1 each interval (or same as said, set it to i)
This lets you keep track of the number both in and out of the script. If you choose the first, then it only stores it INSIDE of the script.

/and set the text label of players.

Server-sided timer here.

This uses a Hint, not an Event. It doesn’t use Values, LocalScripts, TextLabels, or Values, which the OP is trying to make serversided.

This is because you’re firing the server with an Instance. Generally, you shouldn’t do this.

You need to fire the server with a number instead.

However, what you’ll really want to do is allow the client to set, reset, start and stop a timer. This is much more bandwidth efficient, and also helps prevent abuse.

This:

download (8)

is much better than:

download (9)

Additionally, since the client can only indirectly affect the stopwatch, an exploiter can’t:

Untitled Diagram (2)

It’s just an example, not that any of those concepts would be hard to implement.