Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago

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

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

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)
0
YES YES YES~!!!!!!!! YOU'VE FINALLY SOLVED MY LONGEST LASTING PROBLEM! THANK YOU SO MUCH! squidiskool 208 — 4y
0
Nevermind unaccepted, now the car only wants to regen once. squidiskool 208 — 4y
Ad

Answer this question