ClickDetector Broken

So recently I’ve been having a problem where my click detector wasn’t working at all.
The hover mouse icon wasn’t showing and it wasn’t doing what the script was telling it to do.

It was working fine earlier, but now it just seemed to have died.
I did make some changes, and it might be because of that.

local floppa = script.Parent
local ClickDetector = floppa.ClickDetector
local dropperPart = floppa:WaitForChild("dropperPart") -- used to not be here

local replicatedStorage = game:GetService("ReplicatedStorage")
local cash = replicatedStorage:WaitForChild("cash")


local canRun = true
ClickDetector.MouseClick:Connect(function()
	if canRun == true then
		local newCash = cash:Clone()
		local dropperPosition = dropperPart.Position -- dropper position was floppaPosition, dropper part was just floppa.
		local cashPosition = dropperPosition -- dropper position was floppaPosition and at the end, Vector3.new(0,0,6)
		newCash.Position = cashPosition
		newCash.Parent = workspace	
		canRun = false
		wait(0.1)
		canRun = true
	end
end)

image
The parts highlighted used to not exist.

I’ve tried restarting Roblox studio, putting another brick into the game, and re-adding the click detector.
It seems to only work in new games.

I’d appreciate any help!

2 Likes

is the Click Detector even enabled?

Try putting a print statement throught to find where its breaking. Cause it looks fine to me. I think maybe the new part is getting in the way of the click detector. Try shrinking the new part very very small

I don’t think its because of that, it is this size.


It isn’t showing an error message, so I don’t know where it’s breaking.

Hold on, my bad I just realized it is working but the cash isn’t spawning, but that’s all that matters.

is the cash not showing up in the work space at all?

Yeah, I don’t know why that is happening.

I put in a print statement, it printed but then the cash didn’t spawn.

yeah all i can say i this point is put a print on every line. because you code looks 100% fine to me. we are both probably missing something

try using WaitForChild("ClickDetector"), which yields the script until the instance is found
if the cursor doesn’t show up, try restarting studio (had this issue months ago)

1 Like

its printing that the click is being detected. so that can’t be it

Mind sending a file with only the floppa?

I just realised, it happends EVERY SINGLE TIME I CREATE A GAME. its not only just that game.
ive also tried uninstalling and re-insatlling roblox studio.

Same here man. the funny thing is it works if you play the game not using ROBLOX studio.