The code works without the left click detect, but I need the script to not run if right clicked.
local clickDetector = script.Parent
local buttonPressed = false
local ClickModule = require (game:GetService("ServerScriptService").ModuleScript)
function OnClick(Clicker)
if not buttonPressed then
buttonPressed = true
ClickModule(Clicker, script.Parent.Parent)
wait()
buttonPressed = false
end
end
clickDetector.MouseClick:connect(OnClick)
Unfortunately it doesnt with it. I didnt realize this until I used the Server test and it returned Mouse is nil???
local clickDetector = script.Parent
local buttonPressed = false
local ClickModule = require (game:GetService("ServerScriptService").ModuleScript)
local OnClick
OnClick = clickDetector.MouseClick:connect(function(Clicker)
if not buttonPressed then
buttonPressed = true
local Mouse = Clicker:GetMouse()
local event
event = Mouse.Button1Down:connect(function()
ClickModule(Clicker, script.Parent.Parent)
end)
wait()
buttonPressed = false
event:disconnect()
end
end)

2 comments
It may be because the script needs to be a LocalScript to be able to index 'Clicker'. This means you will also have to move the ClickModule to ReplicatedStorage, because the client cannot access any 'Server...' services.
I turned it into a LocalScript and moved clickmodule to replicatedstorage, but now the onClick funtion isnt even being run, i know because i put a print in there at the beginning and it isnt showing when clicked on.