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

How to show a GUI when another GUI button is pressed to everyone?

Asked by 2 years ago
Edited 2 years ago

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

script.Parent.Triggered:Connect(function(player)
    print(player.name .. "has equipped Ammo")
    player.PlayerGui.GameGUI.Frame.TextLabel.Text = "2"
    game.workspace.EquipSFX:Play()
    game.ReplicatedStorage.Key.Parent = workspace
    player.PlayerGui.EveryoneGUI.Revolver.Visible = true -- this is the part where the gui should show up
    script.Parent.Parent:Destroy()
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

2 answers

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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.

local fegui = player.PlayerGui.EveryoneGUI.Revolver.Visible
script.Parent.Triggered:Connect(function(player)
    print(player.name .. "has equipped Ammo")
    player.PlayerGui.GameGUI.Frame.TextLabel.Text = "2"
    game.workspace.EquipSFX:Play()
    game.ReplicatedStorage.Key.Parent = workspace
    game.ReplicatedStorage.remote:FireServer(fegui, true) -- fires the remote and should make it visible to everyone
    script.Parent.Parent:Destroy()
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

0
Not working. The GUI won't show up AIRBORNENicuYT 20 — 2y
Ad
Log in to vote
0
Answered by
valk_3D 140
2 years ago
Edited 2 years ago

create a remote event inside of ReplicatedStorage

Add a local script that detects when the client clicks the button

script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.RemoteEvent:FireServer()
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)

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function()
    print("Showing gui")
end)
0
Simple and easy but how is the script supposed to show the GUI? I see no code for adding the GUI AIRBORNENicuYT 20 — 2y

Answer this question