Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Regenerate script working in studio, but in client it duplicates the car by amount of players?

For some reason when this regenerate script runs, it duplicates the car by amount of players. How do I stop this annoying thing?

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)

1 answer

Try this, it might take some adjustments.

local model = game.Workspace.Lowenherz

game.ReplicatedStorage.LowenherzRemotes.RegenLowenherz.OnServerEvent:Connect(function()
local enabled = true

if enabled == true then
local new - model:Clone()
model:Destroy()

enabled = false

wait(3)

model = new
model.Parent = game.Workspace

wait(5)

enabled = true

end

end)

2 comments

0

YES YES YES~!!!!!!!! YOU'VE FINALLY SOLVED MY LONGEST LASTING PROBLEM! THANK YOU SO MUCH!

0

Nevermind unaccepted, now the car only wants to regen once.

This discussion is preserved as it was. New answers, comments, and votes are closed.