Hi everyone,
I'm trying to dispense a GUI when a certain part is clicked, but it simply doesn't work.
Please check for my mistakes as I'm certainly not the best at scripting. (I dont even understand my mistake)
local btn = script.Parent
local clickde = script.Parent.Parent.Parent.ClickDetector
clickde.MouseClick:Connect(function(playerWhoClicked)
local h = game.Players:GetPlayerFromCharacter(playerWhoClicked)
if h then
local newgui = script.ScreenGui:Clone()
newgui.Parent = h.PlayerGui
end
end)
Thanks!

8 comments
Is the clickde under the part?
Clickde is a child of the part.
The PlayerGui is client-side, and is invisible to server scripts, so if I'm correct, it should work in a local script.
I used a normal script to dispense GUIs to Players before, through that one is far more complex.
You cannot access PlayerGui through ServerScript when FE is turned on. Use Remote events or LocalScripts
FE is off.
Axceed and Sam you're both wrong, you cannot access it, that's true, but you can clone to it or set a parent to it
^ My Bad