Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i use FireAllClients for my gui movement?

So I have this gui where it has a ViewportFrame and an ImageLabel that both move to the center when activated. I activate the gui tweening with a button that's in a controls gui in ServerStorage since only some people can access the controls gui in game. It worked, but only shows it to me. So when I found out about the FireAllClient thing, I tried my best to figure out how to put that in, but none of the things i did work. So I need serious help on this since I have to get this done by Friday.

Here is the script for the ViewportFrame:

local frame = script.Parent

while true do
	frame.Visible = true
	frame:TweenPosition(UDim2.new(0.151, 0,0.21, 0), 'Out', 'Linear', '1')
	wait(10)
	frame:TweenPosition(UDim2.new(-0.609, 0,0.832, 0), 'Out', 'Linear', '1')
	frame.Visible = false
end

And here is the Image Label Script

local frame = script.Parent

while true do
	frame.Visible = true
	frame:TweenPosition(UDim2.new(0,0,0,0), 'Out', 'Linear', '1')
	wait(10)
	frame:TweenPosition(UDim2.new(-1,0,1,0), 'Out', 'Linear', '1')
	frame.Visible = false
end

And the activating script was just enabling the local scripts in the gui.

1 answer

Hi, so how FireAllClients work is from 1 Client to another you send a event. Right so fairly simple right here :

RemoteEvent:FireServer()

Once a script gets it and connects, to the server so say you make a script in the serverscriptservice and it resives it like this simply

RemoteEvent.OnServerEvent:Connect(function()

end)

inside the peramiters, you can do RemoteEvent:FireAllClients(), this will send it to every client. So when you get a local script say a random local script, you can do

OnClientEvent:connect(function()
end)

everyone will receive it and whatever you imply here will imply to everyone else!

So heres a full proof example.

-- Local Script--

script.Parent.MouseButton1Click:connect(function()
	RemoteEvent:FireServer()
end)

RemoteEvent.OnClientEvent:Connect(function()
	print("hai smellies")
end)

-- Script

RemoteEvent.OnServerEvent:Connect(function()
	RemoteEvent:FireAllClients()
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.