So i have game.Workspace.StaffDoor
but when I type S
nothing shows up, so I though, Okay then lets do game.Workspace:FindFirstChild("StaffDoor")
I tested it an the script didn't work the way it did in the other game I created with less parts. Is there a way to fix this?
You should explain in more detail what you mean in future questions:
I'm guessing that your problem is that you have multiple StaffDoor
s and your script is only set up to work with one. If my guess is correct, you'll need to iterate over all the workspace's children, rather than use FindFirstChild
(which only finds the "first child", as the name suggests).
--Instead of: function OnTouch(part) -- function contents here end workspace.StaffDoor.Touched:Connect(OnTouch) --You need: function OnTouch(door, part) --use 'door' instead of 'workspace.StaffDoor'; otherwise, function contents may be the same end local ch = workspace:GetChildren() local door for i = 1, #ch do door = ch[i] door.Touched:Connect(function(part) OnTouch(door, part) end) end