✓ Accepted answer
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:
local replicatedStorage = game:GetService("ReplicatedStorage")
local event = replicatedStorage:WaitForChild("ShowGUI")
script.Parent.ClickDetector.MouseClick:Connect(function(player)
event:FireClient(player)
end)
Then, with the local script inside the ScreenGui, I did this:
local replicatedStorage = game:GetService("ReplicatedStorage")
local event = replicatedStorage:WaitForChild("ShowGUI")
event.OnClientEvent:Connect(function(player)
game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = not game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible
end)
This worked for me, I hope it works for you!
3 comments
click detectors only work from remote events now, what you would need to do is have a script in server listening for your click detector to be clicked on, then fire the event client side and have your gui show up from a local script. if you need me to go more in depth just let me know
where would i put the remote event? replicated storage?
yes