Basically when an player pressed an GUI Button another GUI to everyone pop-ups i have heard of some RemoteEvents but i need help at it.
I scripted it like this
1 | script.Parent.Triggered:Connect( function (player) |
2 | print (player.name .. "has equipped Ammo" ) |
3 | player.PlayerGui.GameGUI.Frame.TextLabel.Text = "2" |
4 | game.workspace.EquipSFX:Play() |
5 | game.ReplicatedStorage.Key.Parent = workspace |
6 | player.PlayerGui.EveryoneGUI.Revolver.Visible = true -- this is the part where the gui should show up |
7 | script.Parent.Parent:Destroy() |
8 | end ) |
But the GUI shows up only to the one who clicked the button not to everyone i tried this but since i beginned scripting 5 days ago i instantly got lost.
If someone can help me please answer i really want to use it for an game. Press here to see a photo of how it is all set up into the explorer
Okay, you are going to want to make that script a localscript. And you can make a remote in replicated storage to change everyone's gui. You can also make it more secure by checking if it was fired by using that prompt.
1 | local fegui = player.PlayerGui.EveryoneGUI.Revolver.Visible |
2 | script.Parent.Triggered:Connect( function (player) |
3 | print (player.name .. "has equipped Ammo" ) |
4 | player.PlayerGui.GameGUI.Frame.TextLabel.Text = "2" |
5 | game.workspace.EquipSFX:Play() |
6 | game.ReplicatedStorage.Key.Parent = workspace |
7 | game.ReplicatedStorage.remote:FireServer(fegui, true ) -- fires the remote and should make it visible to everyone |
8 | script.Parent.Parent:Destroy() |
9 | end ) |
Or you could make another remote and make it fire and a server script could check if the local script fired it.
https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events This should also help too
Thanks for your time - Zeta
create a remote event inside of ReplicatedStorage
Add a local script that detects when the client clicks the button
1 | script.Parent.MouseButton 1 Click:Connect( function () |
2 | game.ReplicatedStorage.RemoteEvent:FireServer() |
3 | end ) |
Create a script inside of ServerScriptService to detect when the event is fired to display your gui to the players(make sure its not a local script)
1 | game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect( function () |
2 | print ( "Showing gui" ) |
3 | end ) |