local player = game:GetService("Players").LocalPlayer
workspace.Part:FindFirstChild("ClickDetector").MouseClick:Connect(function()
local oGUI = script:FindFirstChild("ScreenGui")
if oGUI then
local GUI = oGUI:Clone()
GUI.Parent = player.PlayerGui
end
end)
Im trying to create a local script where if you click a 'Part' , the GUI appears , the script is in replicated storage and the GUI is the child of the script , but for some reason when i do the workspace.Part thing it only says 20:16:23.646 - Part is not a valid member of Workspace I Tried doing it with FindFirstChild as well
workspace:FindFirstChild("Part").ClickDetector.MouseClick:Connect(function()
local oGUI = game.ReplicatedStorage.ScreenGui
if oGUI then
local GUI = oGUI:Clone()
GUI.Parent = player.PlayerGui
end
end)
But it only says 20:38:23.165 - ReplicatedFirst.LocalScript:3: attempt to index nil with 'ClickDetector' , can anybody help me please ?

2 comments
Don't move it to StarterGui otherwise the ScreenGui will be seen, he only wants it to be shown once he clicks.
Oh right, the ScreenGui is a child of the script.