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)