Hello. I was attempting to script a auto-respawn script. When I tested it, the script was cloning the model indefinitely. and also heating up my pc hot enough to cook something on it
I don’t know what went wrong…
Script:
local model = script.Parent
local regentime = 20
regened = true
local modelclone = model:Clone()
modelclone.Parent = game.ServerStorage
model:Destroy()
local modelcloneii = modelclone:Clone()
modelcloneii.Parent = game.Workspace
while true do
wait(regentime)
if regened == true then
regened = false
local removal = game.Workspace:FindFirstChild(model.Name)
removal:Destroy()
local modelclone2 = modelclone:Clone()
modelclone2.Parent = game.Workspace
game.ReplicatedStorage.buildingregen1:FireClient()
wait(10)
regened = true
end
end