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

How do I make a GUI popup for everyone?

Asked by 4 years ago

Hello! I am trying to make a GUI that pops up for everyone once this button is clicked. The buttons script is

(Local Script)

script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.AddPoints:FireAllClients()
end)

RemoteEvent is located in ReplicatedStorage, called AddPoints

In ServerScriptStorage I have this, its called AddPoints

(Regular Script)

game.ReplicatedStorage.AddPoints.OnServerEvent:Connect(function()
    game.StarterGui.AddPoints.Frame.Visible = true
    game.StarterGui.AddPoints.Frame:TweenPosition(UDim2.new(.419,0,.5,0))
end)

I keep getting this error

Image "" failed to load: Unexpected URL FireAllClients can only be called from the server -StackBegin
-Script 'Players.DennisSense.PlayerGui.AddThese.Frame.TextButton.AddPoints', Line2
-StackEnd

0
You can only call fireallclients from the server. What exactly are you trying to do? royaltoe 5144 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

local script

script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.AddPoints:FireServer()--u need to tell the server to do something, a client cant tell other clients anything, it have to go through the server
end)

server script

game.ReplicatedStorage.AddPoints.OnServerEvent:Connect(function(player)--if u want to check who the player is
for i,v in pairs(game.Players:GetPlayers()) do--this for loop goes through every single player
v.PlayerGui.AddPoints.Frame.Visible = true
v.PlayerGui.AddPoints.Frame:TweenPosition(UDim2.new(.419,0,.5,0))--these 2 is all players and will do those 2 things on all players playergui
end
end)
1
Thank you so much! It worked!!! :) DennisSense 23 — 4y
Ad

Answer this question