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?

01model = game.Workspace.Lowenherz -- Change "Compressor" to the name of your model.
02new = model:clone()
03enabled = true
04game.ReplicatedStorage.LowenherzRemotes.RegenLowenherz.OnServerEvent:Connect(function()
05    if enabled then
06        model:Destroy()
07script.Parent["Car Ignition Startup"]:Play()
08enabled = false
09 
10wait(0.3) -- This is how long it will take to regen
11model = new:clone()
12model.Parent = game.Workspace
13wait(5) -- This is how long it will take for the regen button to be enabled after being used
14enabled = true
15end
16end)

1 answer

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

Try this, it might take some adjustments.

01local model = game.Workspace.Lowenherz
02 
03game.ReplicatedStorage.LowenherzRemotes.RegenLowenherz.OnServerEvent:Connect(function()
04local enabled = true
05 
06if enabled == true then
07local new - model:Clone()
08model:Destroy()
09 
10enabled = false
11 
12wait(3)
13 
14model = new
15model.Parent = game.Workspace
View all 23 lines...
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