Im making a script that spawn a Throne in front of me, but sometimes when i die, it bug and i can spawn 2 thrones a time, i made a script that "when i press B, it spawn, when i press B again, it :Destroy", but when existe 2 of it, my script only destroy 1, i made a for to search all Workspace items with the Throne name, but its not working, wt im making wrong?
For Script:
if throneExists then
for _, v in pairs(game.Workspace:FindFirstChild("BaragganThroneRemote")) do
v:Destroy()
wait(.1)
end
else
local clone = model:Clone()
clone.Parent = workspace
clone:PivotTo(character.HumanoidRootPart.CFrame * CFrame.new(0, 1.3, 0) * CFrame.Angles(math.rad(180), math.rad(90), math.rad(0)))
end

4 comments
Idk how you set up the workspace, but assuming you have a folder with all the parts of the throne, then you simply just reference the folder and folder:GetChildren():Destroy(). This is not an exact solution but you try something similar to this
or you can select all the parts of the throne and hit Ctrl + G to make it a model and make your script summon and destroy the model
its already a model, its that "BaragganThroneRemote", i want a For that keep searching if there's something named "BaragganThroneRemote" in the Workspace and If Yes, destroy it.
@Shampoo02496 - GetChildren() returns an array, not an instance object. Calling Destroy() on GetChildren() will throw an invalid property error.