Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would modify this into a click regen?

Asked by 9 years ago

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)

0
Code block please. yumtaste 476 — 9y

1 answer

Log in to vote
0
Answered by
P100D 590 Moderation Voter
9 years ago

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
Ad

Answer this question