Hello devs Im making a safe zone and in this script it has a error called Destory is not a vaild member of LocalScript “Workspace.SafeZone.Unfilltered Weapon.Minecraft Diamond Sword.LocaScript”
Error Code =
local unfilldered_weapon = script.Parent:FindFirstChild("Unfilltered Weapon")
if unfilldered_weapon then
for i, v in pairs(unfilldered_weapon:GetChildren()) do
if v:IsA("Tool") then
v.Enabled = false
for i, parts in pairs(v:GetChildren()) do
parts:Destory()
end
end
end
end
Also in the future you should use :ClearAllChildren() when you want to destory all children of an instance
local unfilldered_weapon = script.Parent:FindFirstChild("Unfilltered Weapon")
if unfilldered_weapon then
for i, v in pairs(unfilldered_weapon:GetChildren()) do
if v:IsA("Tool") then
v.Enabled = false
v:ClearAllChildren()
end
end
end
local unfilldered_weapon = script.Parent:FindFirstChild(“Unfilltered Weapon”)
if unfilldered_weapon then
for i, v in pairs(unfilldered_weapon:GetChildren()) do
if v:IsA(“Tool”) then
v.Enabled = false
for i, parts in pairs(v:GetChildren()) do
parts:Destroy()
end
end
end
end
You misspelled “Destroy”, you typed “Destory” instead. This would be the final code:
local unfilldered_weapon = script.Parent:FindFirstChild("Unfilltered Weapon")
if unfilldered_weapon then
for i, v in pairs(unfilldered_weapon:GetChildren()) do
if v:IsA("Tool") then
v.Enabled = false
for i, parts in pairs(v:GetChildren()) do
parts:Destroy()
end
end
end
end