My ClickDetector is not firing the MouseClick event. I have done all the Luau syntax right.
Expected Behaviour: When I click the ClickDetector, the MouseClick should fire and the boolean value should be set to false.
Actual Behaviour: The ClickDetector’s MouseClick event does not fire.
My code:
-- Definitions
local Panel = script.Parent.Parent.Parent.Parent
local LCD = Panel.LCD
local ThirdPartyFolder = Panel.Parent.Sounders.ThirdParty
local PanelScripts = Panel.PanelScripts
local Piezo = Panel.Body.ElectronicsCase.Piezo
local ClickD = script.Parent.ClickDet
-- Code
local function SilenceReset()
PanelScripts.MarchtimeScript.Enabled = false
PanelScripts.Code3Script.Enabled = false
ThirdPartyFolder.ThirdPartyOnOff.Value = false
LCD.SurfaceGui.NormalScreen.Visible = true
LCD.SurfaceGui.FireWarning.Visible = false
Piezo:Stop()
end
ClickD.MouseClick:Connect(SilenceReset)
Reproduction: No reproduction, it happens randomly out of nowhere.
Edit: The UI of my phone keeps on changing from each device! The phone UI on my ipad is stretched more than the UI for the phone on my computer! Here’s the size: {0.307, 0},{0.623, 0} and the Position: {0.809, 0},{0.545, 0}
Unrelated, and it cannot be categorized as a bug either-way.
Please also link your sample file for staff and even other people to reproduce the issue on. I do not have a problem with ClickDetectors, and it’s more than likely a you-issue. If it was indeed a problem with CD’s globally, a lot of reports would’ve been posted by now, as it is a widespread “mechanic” in a lot of games.
Just checked and ClickDetectors are working as expected, you are likely standing too far away from the ClickDetector, you could try increasing the maximum activation distance.
Also your UI is working as expected since you are defining the sizing of your UI elements using a scaling factor rather than offset. {0.307, 0}, {0.623, 0} means your component’s can be defined as 30.7% of the width and 62.3% the height of it’s parent component.