I have made a Click Detector script but when I finish clicking and when it came back nothing worked why?
local Rock = game.Workspace.Rock
local target = game.ReplicatedStorage.ClickDetector
local TimesClicked = 0
local a = game.Workspace.Rock.ClickDetector.Script
local Click = game.Workspace.Rock.ClickDetector
script.Parent.mouseClick:Connect(function(Player)
TimesClicked = TimesClicked +1
if TimesClicked == 3 and TimesClicked ~= nil then
Player.leaderstats.SpacePieces.Value = Player.leaderstats.SpacePieces.Value +2
script.Parent.Parent.Transparency = 1
script.Parent.Parent.CanCollide = true
a.Parent = game.Workspace.Rock
Click:Destroy()
wait(3)
Rock.Transparency = 0
Rock.CanCollide = false
local ClickDetector = target:Clone()
ClickDetector.Parent = game.Workspace.Rock
end
end)
Please help!

2 comments
Is it a server or local script? And btw mouseClick is deprecated so use MouseClick
a script