Car regenerate script duplicates car by amount of players?

This is a repost since the other thread died out quickly
So hey, I am trying to fix this regeneration script for this RC car demo. It duplicates the car by the amount of players for some reason. This is the result I do not want. Here is how it happens:
1 player: RC car regenerates like normal, expected result
2 players: RC car regenerates and adds another car; not expected result
3 players: RC car regenerates and adds 2 more cars; not expected result
…and so on.
Here is the code, I based it off of an old regenerate script:

model = game.Workspace.Lowenherz -- Change "Compressor" to the name of your model.
new = model:clone()
enabled = true
game.ReplicatedStorage.LowenherzRemotes.RegenLowenherz.OnServerEvent:Connect(function()
	if enabled then
		model:Destroy()
script.Parent["Car Ignition Startup"]:Play()
enabled = false
wait(0.3) -- This is how long it will take to regen
model = new:clone()
model.Parent = game.Workspace
wait(5) -- This is how long it will take for the regen button to be enabled after being used
enabled = true
end
end) 

Here is example if you want to know the structure:
example.rbxl (71.2 KB)

I would recommend putting your code in a code block instead of quoting it. By the way, please format your code so it is readable to others trying to help you.

How would I do that functionn?

Can you explain what you mean by function? By the way, please do not make duplicate topics next time as it is against the rules.

Sorry, I did that to extend my reply to make it post. I’m saying how do I format my code into a code block?

By putting three backticks at the beginning and end of your script.

It’s likely due to when you’re calling this “RegenLowenherz” Remote Event.

Could you share the code that fires this event to the server?

Here.

script.Parent.MouseButton1Click:connect(function()
    game.ReplicatedStorage.LowenherzRemotes.RegenLowenherz:FireServer()
end)

Well, you say if enabled is true to destroy the model, but it should be if enabled is false it destroys the model, since it is true when it is supposed to be spawnable. Maybe that will fix it?

I’m a bit bad at scripting, can you please provide an example with your idea using my script?

model = game.Workspace.Lowenherz -- Change "Compressor" to the name of your model.
new = model:clone()
enabled = true
game.ReplicatedStorage.LowenherzRemotes.RegenLowenherz.OnServerEvent:Connect(function()
	if enabled == false then -- the only line I changed - Ty_IsHomeSchooled
		model:Destroy()
script.Parent["Car Ignition Startup"]:Play()
enabled = false
wait(0.3) -- This is how long it will take to regen
model = new:clone()
model.Parent = game.Workspace
wait(5) -- This is how long it will take for the regen button to be enabled after being used
enabled = true
end
end) 

Tried that and now it won’t even work with no error.

Hmm, that’s weird…
I’m thinking real hard and it might be a different script giving you errors. May I see the client-side?

Here’s the client-side script.

you aren’t supposed to do that

You’re cloning the clone of the model. try this. also you had nothing saying that if enabled was false to cut the script.

model = game.Workspace.Lowenherz -- Change "Compressor" to the name of your model.
enabled = true
game.ReplicatedStorage.LowenherzRemotes.RegenLowenherz.OnServerEvent:Connect(function()
	if enabled then
          script.Parent["Car Ignition Startup"]:Play()
          model:Destroy()
          enabled = false
          wait(0.3) -- This is how long it will take to regen
          new = model:clone()
          new.Parent = game.Workspace
          wait(5) -- This is how long it will take for the regen button to be enabled after being used
          enabled = true
       elseif enabled == false then
          return
       end
end) 

Well I think you forgot the :Destroy() part because it is just duplicating the car and not removing the old one.

Oh, sorry. Editing above post…

Tried the updated script and the car just disappears.

Cause I’m an idiot and put it before it had a chance to clone. Move model:Destroy() to below new.Parent = game.Workspace

And now it just plays the startup sound and nothing happens. Is it because enabled = false is after the startup sound?