Roblox Scripting Tutorial: Regen Button

Channel:
Subscribers:
2,110
Published on ● Video Link: https://www.youtube.com/watch?v=91UxYbQrGFg



Category:
Tutorial
Duration: 15:25
14,564 views
108


Hey, guys! In this video we will be learning how to make a regeneration button that you can either touch or click! Sorry about the length of the video.

Scripts
-Touch
model = script.Parent.Parent.Bodykit
backup = model:clone()
debounce = false

function onTouched(p)
if p.Parent:findFirstChild("Humanoid") ~= nil then
if debounce == false then
debounce = true
newcar = backup:clone()
model:remove()
newcar.Parent = script.Parent.Parent
newcar:MakeJoints()
script.Parent.BrickColor = BrickColor.new("Black")
wait(2)
script.Parent.BrickColor = BrickColor.new("Bright violet")
debounce = false
end
end
end

script.Parent.ClickDetector.MouseClick:connect(onTouched)

-Click
model = script.Parent.Parent.Bodykit
backup = model:clone()
debounce = false

function onTouched()
if debounce == false then
debounce = true
newcar = backup:clone()
model:remove()
newcar.Parent = script.Parent.Parent
newcar:MakeJoints()
script.Parent.BrickColor = BrickColor.new("Black")
wait(2)
script.Parent.BrickColor = BrickColor.new("Bright violet")
debounce = false
end
end

script.Parent.ClickDetector.MouseClick:connect(onTouched)

Be sure to follow Laura and I on Twitter after rating, commenting, and subscribing!
Me :https://twitter.com/Rrrrry123
Laura: https://twitter.com/lauraperry123

Also, follow me on Twitch for some live streams!
http://www.twitch.tv/Rrrrry123







Tags:
Rrrrry123
Rrrrry2468
Twitter
Laura
Ryan
Block
Brick
Roblox
Minecraft
Runescape
Spyro
Let's
Play
Nostalgia
Scripting
Tutorial
Lua
Script
Regen
Button
Regeneration
Regenerator
Click
Touch