Advertisement
enanis

Roblox Vehicle Regen Button Script

Jan 19th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. -- Put this script in your button and put your button in the same model as your vehicle
  2.  
  3. model = script.Parent.Parent--Indicates that the script interacts with the model the button is grouped with.
  4.  
  5.  
  6. backup = model:clone()
  7. enabled = true
  8.  
  9. function regenerate()
  10. model:remove()
  11.  
  12. wait(3)--
  13.  
  14. model = backup:clone()
  15. model.Parent = game.Workspace
  16. model:makeJoints()
  17.  
  18. script.Disabled = true
  19. script.Parent.BrickColor = BrickColor.new(26)--Black
  20. wait(3)--Change this number to change the time in between regenerations via the button, in seconds..
  21. script.Parent.BrickColor = BrickColor.new(104)--Purple
  22. script.Disabled = false
  23. end
  24.  
  25. function onHit(hit)
  26. if (hit.Parent:FindFirstChild("Humanoid") ~= nil) and enabled then
  27. regenerate()
  28. end
  29. end
  30.  
  31. script.Parent.Touched:connect(onHit)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement