For some reason when this regenerate script runs, it duplicates the car by amount of players. How do I stop this annoying thing?
01 | model = game.Workspace.Lowenherz -- Change "Compressor" to the name of your model. |
02 | new = model:clone() |
03 | enabled = true |
04 | game.ReplicatedStorage.LowenherzRemotes.RegenLowenherz.OnServerEvent:Connect( function () |
05 | if enabled then |
06 | model:Destroy() |
07 | script.Parent [ "Car Ignition Startup" ] :Play() |
08 | enabled = false |
09 |
10 | wait( 0.3 ) -- This is how long it will take to regen |
11 | model = new:clone() |
12 | model.Parent = game.Workspace |
13 | wait( 5 ) -- This is how long it will take for the regen button to be enabled after being used |
14 | enabled = true |
15 | end |
16 | end ) |
Try this, it might take some adjustments.
01 | local model = game.Workspace.Lowenherz |
02 |
03 | game.ReplicatedStorage.LowenherzRemotes.RegenLowenherz.OnServerEvent:Connect( function () |
04 | local enabled = true |
05 |
06 | if enabled = = true then |
07 | local new - model:Clone() |
08 | model:Destroy() |
09 |
10 | enabled = false |
11 |
12 | wait( 3 ) |
13 |
14 | model = new |
15 | model.Parent = game.Workspace |