generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: help with regen buttons

Previous Thread :: Next Thread 
Jack1278 is not online. Jack1278
Joined: 27 Apr 2010
Total Posts: 5943
01 Jun 2016 10:05 PM
i want to make a car that you can regen using a button. i followed what the wiki said, and it worked. but my problem is that whenever someone presses the regen button, the car disappears whilst i am driving it instead of respawning another one for the person who pressed the button. basically the regen button just sends the car back to its original spot rather than creating duplicates of it. how can i fix this??

Report Abuse
Jack1278 is not online. Jack1278
Joined: 27 Apr 2010
Total Posts: 5943
01 Jun 2016 10:07 PM
script:

local model = game.Workspace.TruckThing

local message = Instance.new("Message")
message.Text = "Regenerating "..model.Name
local backup = model:clone()
local regenerating = false

function regenerate()
if regenerating then
return
else
regenerating = true
end

model:Destroy()

message.Parent = nil
wait(0)
message.Parent = nil

model = backup:clone()
model.Parent = game.Workspace
model:makeJoints()

wait(15)
regenerating = false

end

script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
regenerate()
game.Workspace.Button.BrickColor = BrickColor.new("Black")
wait(15) game.Workspace.Button.BrickColor = BrickColor.new("Bright violet")
end
end)
Report Abuse
FPSPwnz0r is online. FPSPwnz0r
Joined: 27 Jun 2011
Total Posts: 2737
01 Jun 2016 10:08 PM
try removing model:Destroy()


Report Abuse
Jack1278 is not online. Jack1278
Joined: 27 Apr 2010
Total Posts: 5943
01 Jun 2016 10:11 PM
@fps
thank you very much. i can't believe i was stupid enough to not realize that was the problem lol.
Report Abuse
FPSPwnz0r is online. FPSPwnz0r
Joined: 27 Jun 2011
Total Posts: 2737
01 Jun 2016 10:55 PM
np xD


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image