I don’t understand why my script is not working

So I’m writing a script so when you click a part a GUI pops up. I am a beginner scripter ( like very beginner ) and I need help understand why it’s not working.


 local Screen = game.Workspace.Screen
local Click = Instance.new(“ClickDetector,Screen”)
Click.MouseClick:connect(function() then
game.ReplicatedStorage.ShowGUI:FireClient()
end)

Here are the video of my code ( Sorry for the watermark i had to mute the video )

If you Can explain why it’s giving me an error and help me with this please let me know I really need help! :pray:

Please paste your code into the post using the code blocks.

1 Like

Will do one second! I will do that right now.

FireClient requires a Player argument to use.

You can get this by passing a Player argument in the MouseClick function, like so:

MouseClick:connect(function(Player)

Try this:

local Screen = game.Workspace.Screen
local Click = Instance.new("ClickDetector", Screen)
Click.MouseClick:Connect(function(player)
game.ReplicatedStorage.ShowGUI:FireClient(player)
end)

Alright I’ll try it! I will mark it as a solution if this works! :smiley:

Alright I’ll try that! If it works I’ll mark as solution! :smiley: