So i want to make a script that will respawn a part (model = script.Parent.blocks) when the script.Parent.Ded.Value is equal to 0
Here what i did, but it doesn't work
local Spawner = script.Parent.PartSpawn model = script.Parent.blocks backup = model:clone() waitTime = 1 function getvalue() areuthere = script.Parent.Ded.Value end getvalue() if areuthere == 0 then wait(waitTime) model:remove() model = backup:clone() model.Position = Spawner.Position + Vector3.new(math.random(-Spawner.Size.x/2, Spawner.Size.x/2), math.random(0,10), math.random(-Spawner.Size.z/2,Spawner.Size.z/2)) model.Parent = script.Parent model:makeJoints() end
Please help, thanks
First of all, if you are trying to make it spawn bricks or models constantly, you need to position it where you want it to spawn and put it in replicated storage so it can be cloned.
local Spawner = script.Parent.PartSpawn model = game.ReplicatedStorage.blocks backup = model:clone() waitTime = 1 while true do if model.Location = game.Workspace then model:clone:(false) else model:clone:(true)
Also, why did you make the "waittime" a variable when you could just do wait(1)?