I want to be able to make a regen button that does not remove the model when regenerating a second time. This is a problem because whenever I use a vehicle with a regen and someone touches the regen, the vehicle that I was currently in disappears. What I mean is to duplicate a model without taking away another.
Use this regenerate script:
local myModel = workspace.Vehicle local button = script.Parent local deb = false myModel.Parent = nil --Hide your model, it still exists button.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if not deb and player then deb = true local newModel = myModel:clone() newModel.Parent = player.Character wait(5) deb = false end end)
If you wanted to prevent vehicle clutter, you could put this script inside of the seat of your vehicle,
local seat = script.Parent local car = seat.Parent --Taking a guess seat.ChildRemoving:connect(function(child) if child:IsA("Weld") then car:Destroy() end end)
In fact, I wouldn't even use my regenerate script and I would just use the one that Roblox uses for their vehicles in the old starter map (assuming that it doesn't exist anymore.) I can't find a uncopylocked version but if you search free models, I'm sure you'll find it.
Put the model in lighting and put in the following code:
model = game.Lighting.ItemName:Clone() -- replace "ItemName" with the model's name model.Parent = game.Workspace model.Position = Vector3.new(0,0,0) -- replace (0,0,0) with the position you want it to be placed at when it generates
you wanted to go to heaven