When I fly the spaceship downwards and eventually crash into the void, I die. When I go to the Regen button, nothing happens anymore. Usually it works when the ship is still somewhere, but now it does not. Anyone know why?
wait(5)
local regen = script.Parent
local Racer = script.Parent.Parent.Parent:WaitForChild("Racer")
local purchases = script.Parent.Parent.Parent
local purchasedObjects = script.Parent.Parent.Parent.Parent.PurchasedObjects
local clone = Racer:Clone()
local active = true --debounce
local playerName = script.Parent.Parent.Parent.Parent.Owner.Value.Name
local folderName = playerName.."Ships"
local serverLocation = game.ServerStorage:WaitForChild(folderName)
clone.Parent = serverLocation
regen.Touched:Connect(function(hit)
if active then
local active = false
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
if script.Parent.Parent.Parent.Parent.Owner.Value == player then
script.Parent.Parent.Parent.Racer:Destroy()
local cloclone = clone:Clone()
cloclone.Parent = purchasedObjects
end --future shooting, body will have health bar, when 0, body+seat+player destroyed.
--model remains, when regenerate destroy model, get new. No outside script needed
end
wait(3)
active = true
end
end)