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
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)