Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why won't the parts unanchor?

I made a script that unanchors all parts in the map when a value gets to 0. However, when this happens,only some parts unanchor and there's no errors in the output. Here is the script;

s = Instance.new("SpawnLocation")

function unanchorAll()
local v = game.Workspace:GetChildren()
for i = 1,#v do
  if v[i]:IsA "Part" or v[i]:IsA "UnionOperation" then
   v[i].Anchored = false
  end
 end
end

while true do
	if game.Workspace.Shields.Value <= 0 then
		unanchorAll()
		game.Workspace.SD:play()
		if game.Workspace:FindFirstChild("borg")~= nil then
			game.Workspace.borg:Destroy()
		end
		wait(4)
		s.Parent = game.Workspace
	end
	wait(2)
	end

Why isn't this working?

1 answer

Because some parts maybe be in a model so you need to make an or if v[i]:FindFirstVhild("Part")

1 comment

0

wat

This discussion is preserved as it was. New answers, comments, and votes are closed.