Answered by
5 years ago Edited 5 years ago
What I did was I used a RemoteEvent, a script in the brick, and a local script in the GUI.
For the script inside the brick I did this:
1 | local replicatedStorage = game:GetService( "ReplicatedStorage" ) |
2 | local event = replicatedStorage:WaitForChild( "ShowGUI" ) |
4 | script.Parent.ClickDetector.MouseClick:Connect( function (player) |
5 | event:FireClient(player) |
Then, with the local script inside the ScreenGui, I did this:
1 | local replicatedStorage = game:GetService( "ReplicatedStorage" ) |
2 | local event = replicatedStorage:WaitForChild( "ShowGUI" ) |
4 | event.OnClientEvent:Connect( function (player) |
5 | game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = not game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible |
This worked for me, I hope it works for you!