What i am trying to achieve: Whenever i click a button, it runs a function for all clients.
Script in SSS:
game.ReplicatedStorage.RemoteEvent:FireAllClients()
Local Script in GUI:
local function clocks() while clock do game.Workspace.Value.Clock.Value = game.Workspace.Value.Clock.Value - 1 sb.Frame.PC.Text = game.Workspace.Value.Clock.Value if game.Workspace.Value.Clock.Value == 0 then -- play sound break end wait(1) end end -- main main.StartPC.MouseButton1Click:connect(function() if clock then return end clock = true game.ReplicatedStorage.RemoteEvent.OnClientEvent:connect(function() clocks() end) end)
Any help?
You would fire the server, and the server would fire all the clients.
Script
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player) game.ReplicatedStorage.RemoteEvent:FireAllClients() end)
LocalScript
local function clocks() while clock do game.Workspace.Value.Clock.Value = game.Workspace.Value.Clock.Value - 1 sb.Frame.PC.Text = game.Workspace.Value.Clock.Value if game.Workspace.Value.Clock.Value == 0 then -- play sound break end wait(1) end end -- main main.StartPC.MouseButton1Click:Connect(function() if clock then return end clock = true game.ReplicatedStorage.RemoteEvent:FireServer() -- Fire the server end) game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function() clocks() end)