I'm having an error where my car doesn't spawn back in after it has been destoryed. Not sure why, however here is a gif for my detail on what I'm trying to explain: Link
Script I'm working on:
local player = game.Players.LocalPlayer.UserId -- localplayer's id
local playername = game.Players.LocalPlayer.Name -- localplayer's name
local car = game.ReplicatedStorage.Cars.PoliceCar -- location of car
local clonedcar = car:Clone()-- clones car
function SpawnCar()
clonedcar.Name = player -- changes name of car to localplayer's id
clonedcar.VehicleSeat.Owner.Name = playername -- changes the owner of the car to the player's name
clonedcar.Parent = game.Workspace -- moves car to workspace
end -- everything above here works fine.
script.Parent.MouseButton1Click:connect(function() -- on button click
if game.Workspace:FindFirstChild(player) == nil then -- if car doesn't exist then
SpawnCar() -- spawn new car
else
game.Workspace:FindFirstChild(player):Destroy()
wait(1)
SpawnCar()
end
end)
If you need more information, please contact me. :)

1 comment
Try moving the clonedcar variable into the function SpawnCar. That way it will clone a new copy each time the function is called. I know it sounds odd and picky, but think of it as a new instance. Hope it helps, and if it doesn't just contact me!