Where do I put FireAllClient in this code?
minigames=game.Lighting.Maps:GetChildren() local g=game.StarterGui.ScreenGui.TextBox local players = game:GetService("Players") local numPlayers = players.NumPlayers wait(3) while true do wait(3) if numPlayers>4 then wait(3) g.Visible=true g.Text='Chosing Map' ranGame=math.random(1,#minigames) gamechosen=minigames[ranGame] g.Text='The Round For This Round Will be'..gamechosen.Name wait(3) gamechosenclone=gamechosen:Clone() gamechosenclone.Parent=game.Workspace for i=10,1,-1 do wait(3) g.Text='Time Left'..i end g.Text='Game Ended' wait(3) gamechosenclone:Destroy() else g.Visible=true g.Text='There Needs To Be At Least 4 Players To Start' end end
In that server code, add to the top
local Event = Instance.new("RemoteEvent",game:service("ReplicatedStorage")) Event.Name = "Event"
Create a LocalScript, put it in the ScreenGui, and put this:
local RepStorage = game:GetService("ReplicatedStorage") local Event = RepStorage:WaitForChild("Event") local GUI = script.Parent local textframe = GUI:WaitForChild("TextBox") Event.OnClientEvent:connect(function(text) textframe.Text = text end)
Now in the server script, anywhere g.Text
is used, replace it with Event:FireAllClients(text)