script.Parent.MouseClick:connect(function(Clicked) game.Players:GetPlayerFromCharacter(Clicked).PlayerGui.ScreenGui.Frame.Visible = true end)
I'm very new to scripting, so sorry if this is a simple error or wrong all together. I'm trying to be able to click a brick and have a Gui pop up, but whatever I do, it will not work. I'm not getting any errors in the output box, and my Gui works because if I make it visible in StarterGui and test it, I see it. The enter and close buttons work, too, but whatever script I put in the part that is clicked seems to not work. Please help! Thank you. PS - I have a clickdetector, script, and Music in the part.
This is because of two reasons, 1: you cannot get the playergui from the server and 2: the clicked argument is the player that clicked, so you really don't need the GetPlayerFromCharacter function.
workspace.Part.ClickDetector.MouseClick:Connect(function(plrwhoclicked) print(plrwhoclicked:GetFullName()) end)
So what you are trying to do here can be accomplished inside a local script as the MouseClick event of the click detector can be used from the client. And on the client, we can modify the playergui as we please. You really only need to check if the plr who clicked is the local player
--local script local plr = game.Players.LocalPlayer workspace.Part.ClickDetector.MouseClick:connect(function(player) if plr == player then plr.PlayerGui.ScreenGui.Frame.Visible = true end end)