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
|
  |
| 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
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 2737 |
|
|
| 01 Jun 2016 10:08 PM |
try removing model:Destroy()
|
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 27 Jun 2011 |
| Total Posts: 2737 |
|
| |
|