Sorry, I had posted a question similar to this and did what the answer pertained yet it still didn't change this touch regen into a click regen. Yes I did add a click detector.
local box = script.Parent local debounce = false local everything = {model} local names = {model} local children = game.Lighting:children() for i=1,#children do if (children[i].Name == "Tech") then table.insert(everything, children[i]:clone()) table.insert(names, children[i].Name) end end function regen() for i=1,#everything do game.Lighting:findFirstChild(names[i]):clone() new_thing = everything[i]:clone() new_thing.Parent = game.Workspace new_thing:makeJoints() end end function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Humanoid") if humanoid~=nil and debounce == false then debounce = true script.Parent.BrickColor = BrickColor.new(1020) regen() wait(102) script.Parent.BrickColor = BrickColor.new(1020) debounce = false end end script.Parent.Touched:connect(onTouched)
After you've placed a clickdector in the parent of the script (if the parent is a brick), you'd just have to change.Touched
to .ClickDetector.MouseClick
on the very last line. If you really wanted, you could rename the function of onTouched, but this isn't a requirement.
You'd also need to remove line 28 as there's no humanoid anymore, as well as the humanoid~=nil and
from line 29.
Then you're all set!