Hello, I would like to ask which lines of this script would I need to change to convert this script into a "Click" regen button. Yes number 1 is to add a clickdetector first, I have done that. Any help would be appreciated.
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)
Replace your last line with
script.Parent.ClickDetector.MouseClick:connect(onClicked)
Replace hit with click, and then remove all the things pertaining to click.Parent.Humanoid. Instead it would be
click.Character.Humanoid