Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I use FireAllClients?

Asked by 9 years ago

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


1 answer

Log in to vote
2
Answered by
Tigerism 220 Moderation Voter
9 years ago

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)

0
It underlines Event.Name for some reason Accelital -7 — 9y
0
Forgot to include an extra ) in the first line, sorry Tigerism 220 — 9y
0
It still doesn't show the GUI? Accelital -7 — 9y
0
1y crowsato 0 — 7y
Ad

Answer this question