Hello , with this script im trying to make it so it destroys the parts then replaces them back with a clone from lighting but everytime its says an error , I have tried other ways to make it work but still it doesn’t want to
local current1 = game.Lighting:WaitForChild("Part1")
local current2 = game.Lighting:WaitForChild("Part2")
while true do
local oneClone = current1:Clone()
oneClone.Parent = workspace
local twoClone = current2:Clone()
twoClone.Parent = workspace
wait(1)
oneClone:Destroy()
twoClone:Destroy()
wait(1)
end
Your script attempts to delete them before they’re destroyed due to the loop. I’ve made a tidier version for you.
There isn’t even anything named inside Part1 inside the workspace…?
It should look something like this:
local Part1 = game.Lighting.Part1
local Part2 = game.Lighting.Part2
while true do
wait(1)
Part1:Clone().Parent = workspace
Part2:Clone().Parent = workspace
wait(3)
workspace.Part1:Destroy()
workspace.Part2:Destroy()
end
Check the workspace, also here’s a script that i tried to make for you: (yes I’m putting the parts in ReplicatedStorage.)
local Part = game:GetService(“ReplicatedStorage”).Part
local Part2 = game:GetService("ReplicatedStorage").Part2
while true do
game.Workspace.Part:Destroy()
game.Workspace.Part2:Destroy()
print("Removed.")
wait(1)
Part:clone().Parent = game.Workspace
Part2:clone().Parent = game.Workspace
print("Cloned.")
wait(3)
game.Workspace.Part:Destroy()
game.Workspace.Part2:Destroy()
print("Removed.")
wait(1)
Part:clone().Parent = game.Workspace
Part2:clone().Parent = game.Workspace
wait(3)
end