I checked all the syntax and there aren't any errors that I can see. Can you guys find something?
if game.Players.LocalPlayer.Backpack.Staffcard == true then for i,child in pairs(game.Workspace.Workdoors:GetChildren()) do if child:IsA("Part") then child.CanCollide = false else child.CanCollide = true end end end
If Staffcard is a value inside the Backpack, you have to check if Staffcard.Value == true instead of just Staffcard == true (the instance itself will always be treated as being true). Also, if you wanted this to happen whenever the Staffcard value changed, you would have to put it in a Changed function. Also I'm not sure why you're tying to change the CanCollide of something if it isn't a part.
game.Players.LocalPlayer.Backpack:WaitForChild("Staffcard").Changed:Connect(function(newVal) for i,child in pairs(game.Workspace.Workdoors:GetChildren()) do if child:IsA("BasePart") then if newVal == true then child.CanCollide = false else child.CanCollide = true end end end end)
Otherwise, if it is a tool, you may want to look into using FindFirstChild or ChildAdded.