This script is to open a GUI on the click of the part.
(I am a very basic scripter, so I do not know much about click detectors)
(This script may be outdated)
Thank you!
You’re using a server script to control a GUI element, which is wrong, GUIs are supposed to be controlled from the client, in other words from a local script.
And personally, a very good advice: never copy paste scripts. It’s a bad habit, and you honestly won’t learn anything, you’re better of to make an attempt using what you already know, if it failed or you’re stuck, ask for help!
Information is missing; this does not look like a complete error. What I would assume though is that you’re getting a nil value error.
Where are you writing this from? If you aren’t using a LocalScript, LocalPlayer will be nil. No functions or methods will exist for it, considering its a reference to the current player that’s blank.
This a local script yes? And did you put it under Workspace? I’m assuming the parent of the ClickDetector is a brick/part. Unfortunately local scripts don’t work under Workspace.
I’ve tested it and it works 100% , I just made it
here’s the code, Server Script ofcourse, in the part, as in this specific case you require for there to be one part, just one, and for there to show a gui on clicking it,
and make sure Egg is a screengui and is called just that and is parented to StarterGui and has the child, Frame called Frame and is set to visible=false
Here’s my code :
function onClicked(playerWhoClicked)
local playerWhoClicked = playerWhoClicked
playerWhoClicked.PlayerGui.Egg.Frame.Visible=true
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
But remember , unless you don’t script this by yourself, you’ll become dependent on others for scripts.
**Edited , this version is shortened, reducing memory consumption
Just touching on the solution providers script. It can be shortened.
script.Parent.ClickDetector.MouseClick:connect(function(player)
player.PlayerGui.Egg.Frame.Visible=true – this won’t work on the server though. You’ll need a remote event to make this happen, so you can connect over to the client side.
make_visible()
End
Sorry for not indenting it properly. I’m on my phone.