I try looping this script fails to, can anyone help?
local Detector = script.Parent
local TimesClicked = 0
local target = game.ReplicatedStorage.ClickDetector
script.Parent.mouseClick:Connect(function(Player)
Detector:Destroy()
wait(5)
local ClickDetector = target:Clone()
ClickDetector.Parent = game.Workspace.Rock
TimesClicked = TimesClicked +0.5
if TimesClicked >= 3 and TimesClicked ~= nil then
Player.leaderstats.LifeFormFound.Value = Player.leaderstats.LifeFormFound.Value +1
script.Parent.Parent.Transparency = 1
script.Parent.Parent.CanCollide = false
wait(20)
script.Parent.Parent.Transparency = 0
script.Parent.Parent.CanCollide = true
end
end)
Someone help please!

1 comment
Also, your code is a mess, use indentation to help solve this, it makes it easier for us.