✓ Accepted answer
Use this regenerate script:
local myModel = workspace.Vehicle
local button = script.Parent
local deb = false
myModel.Parent = nil
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
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.
3 comments
The model should go in ServerStorage.
Also note that Models do not have a Position property.
That was my mistake, should've put MoveTo.