Code I have so far:
script.Parent.ClickDetector.MouseClick:Connect(function(Player) Player.PlayerGUI.AreYouSureGUI.Frame.Visible = true end)
I know this question has been asked and answered a lot, but trying those solutions would not work! I get this error:
PlayerGUI is not a valid member of Player
What am I doing wrong here?
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") --The RemoteEvent is named "ShowGUI" script.Parent.ClickDetector.MouseClick:Connect(function(player) event:FireClient(player) --Sending a message through the RemoteEvent to change the GUI 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 --(I just did this to make it so it would be like a on / off button, you can change the right side of the equals to "true" if you want it to just be a once-activated thing.) end)
This worked for me, I hope it works for you!