script.Parent.ClickDetector.MouseClick:Connect(function() local gui = game.Players.LocalPlayer.PlayerGui.WantLuck -- Name of Gui gui.Frame.Visible = true end)
This seems like it should work to me. I have tried this script in both Local and regular script. Every time I click the part nothing happens. No errors in the output. How would you make a script that opens a gui after being clicked?
ServerScripts can't look into PlayerGui and LocalScripts doesn't work in Workspace. To solve this you will have to use a RemoteEvent. Start with creating a RemoteEvent in ReplicatedStorage and name it what suits you, then you create a LocalScript in "WantLuck" and a ServerScript in your Part.
ServerScript
local remEvent = game.ReplicatedStorage.RemoteEvent -- change this to the name of your Event script.Parent.ClickDetector.MouseClick:Connect(function(player) remEvent:FireClient(player) end)
LocalScript
local remEvent = game.ReplicatedStorage.RemoteEvent -- change this to the name of your Event aswell remEvent.OnClientEvent:Connect(function() script.Parent.Frame.Visible = true end)
I hope this helped and if so I would gladly appreciate if you could accept my answer.