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

How i can make the regen (spawn) system, that spawns multiple amount of cars?

Asked by 2 years ago

i want to make script, that will spawns a car, but if car is already has spawned on the original position of the model, next car couldn't spawns on other's car position. Other thing, that i want to it be in the script, is car amount (maybe 12 car can be spawned), i don't want to cars spawn to much, make some system what makes cars disappearing if people near car aren't present. And if character dies, car destroys with character.

There's my stupid try to make script, i connected two others scripts (i'm so bad at scripting).

local IgnoreList = {"Inv"} local Box = game.workspace.Model.SpawnBox local TouchingParts = Box:GetTouchingParts() for i = 1,#TouchingParts do if table.find(IgnoreList,TouchingParts[i]) then

else

model = system.Station system = script.Parent backup = model:Clone() regen = system.Regen

function checkRegen()

if regen.Value == 1 then model:remove() wait(1) model = backup:Clone() model.Parent = system model:MakeJoints() end

    end
end

end

regen.Changed:connect(checkRegen)

backup = model:Clone() regen = system.Regen

function checkRegen() if regen.Value == 1 then

    model:remove()

    wait(1)
    model = backup:Clone()
    model.Parent = system
    model:MakeJoints()
end

end

regen.Changed:connect(checkRegen)

Answer this question