What i want: at the end of a round the main script triggers a separate script to remove tags from spawners so enemies do not spawn in locations the player wont have access to.
what error im seeing:
Unable to cast value to Object
Stack Begin - Studio
Script 'ServerScriptService.DisableSpawns', Line 3
Stack End
Heres the code:
local CollectionService = game:GetService("CollectionService")
local OBJ = game.Workspace.Map.Normal:GetChildren("A1" , "A2" , "A3" , "A35" , "A4" , "A5")
for _, tag in ipairs(CollectionService:GetTags(OBJ)) do
CollectionService:RemoveTag(OBJ, "spawner")
end
wait(3)
script.Disabled = true
I have multiple parts called "A1", "A2"... etc. and they're tagged "spawner" if a player buys a certain door.

1 comment
GetChildren() doesn't take any arguments; it just returns an array containing all children of that object. So passing "A1", "A2", etc doesn't do anything. This could be the source of your error message if OBJ contains children that should not be passed to RemoveTag().