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

2 comments
why are you using a function to get the value? dont do that
I tried several ways but it did not work