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

Why will not FireAllClients() work?

I am trying to tween a Frame's position for everyone.

Here is the local script in the client

`local repStore = game:GetService("ReplicatedStorage") local remote = repStore:WaitForChild("cool") f = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame

remote.OnClientEvent:connect(function() f:TweenPosition(UDim2.new(1, 0, 0, 0), 'Out', 'Linear', 1)

end)`

Here is the script in Serverscriptservice

`local repStore = game:GetService("ReplicatedStorage") local remote = repStore:WaitForChild("cool")

button = game:GetService("StarterGui").ScreenGui.Frame.TextButton

button.MouseButton1Click:connect(function() remote:FireAllClients() end)

`

My remoteevent is in ReplicatedStorage named 'cool'

All that it's suppose to do is, when i click a button the frame moves to the otherside of the screen, and EVERYONE can see it move

1 comment

0

put it in code blocks

1 answer

StarterGui is what clones to the PlayerGui when a player joins, so you cant edit that. Also you cant enter the playergui with a server script. So, you have to insert a localscript, do

also insert a second remoteevent to the replicatedstorage, maybe called "cool2"

local repStore = game:GetService("ReplicatedStorage") 
local remote = repStore:WaitForChild("cool")

button = script.Parent

button.MouseButton1Click:connect(function()
remote:FireServer() 
end)

remote script:

game.ReplicatedStorage.cool.OnServerEvent:Connect(function(plr)
game.ReplicatedStorage.cool2:FireAllClients(plr)
end)

cool2 remote script:

game.ReplicatedStorage.cool2.OnClientEvent:Connect(function()
local plr = game.Players.LocalPlayer
-- whatever script
end)

I know the answer i gave you is pretty dumb, but i hope it helped.

3 comments

0

Should the cool2 script be a local script or a regular script? - u put 'OnClientEvent' So im confused because it will only run that in a local script

0

It worked, Thanks very much! I've been looking all day

0

The cool2 script has to be a localscript on th eplayergui. You can accept my answer if you want, but you dont have to.

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