Roblox Scripting Tutorial: Regen Button

Published: 15 May 2014
on channel: RyGuyGaming
14,806
107

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 :  / rrrrry123  
Laura:   / lauraperry123  

Also, follow me on Twitch for some live streams!
  / rrrrry123  


On this page of the site you can watch the video online Roblox Scripting Tutorial: Regen Button with a duration of hours minute second in good quality, which was uploaded by the user RyGuyGaming 15 May 2014, share the link with friends and acquaintances, this video has already been watched 14,806 times on youtube and it was liked by 107 viewers. Enjoy your viewing!