Looking for a simple, yet customizable solution to your door problems? Well look no further, because I’ve created a user-friendly door system that has everything you need including features that you can use or toggle with a simple true or false statement in the code. Just insert the model into your game, follow a few steps, and you are done! You can change everything from interaction cooldowns, to the door’s rotation direction. Everything in this model is designed to be easy to use and includes a description for every configuration, making it easy to understand how to tweak things to your liking.
Key Features
-
Kickable doors, with tweakable properties
- You can kick open a door! How cool is that?
-
Double-sided door swings
- You can choose between a fixed swing direction and a swing direction relative to the players side of the door.
-
Lock system
- Choose to lock your door under a specific key name that you can change.
Important Notes
-
If you are looking to toggle the door kicking feature, the script requires you to make a folder in workspace named “Debris”, otherwise it will return an error and the bustDoor() function will not work.
-
When enabling “requiresKey”, the default key name format uses the doorNum value, which is put under the main script. If you want to use the default lock settings without changing anything, the door will take keys under the name “Key (215)”.
-
If you don’t want players colliding with unanchored door debris (for when the door is kicked), create a script in ServerScriptService that will handle the collision groups of children added to the debris folder, and the character parts of new players. Although this code is not the best, something like this should work:
local physicsService = game:GetService("PhysicsService")
local debrisFolder = workspace:WaitForChild("Debris")
local players = "Players"
local debris = "Debris"
physicsService:RegisterCollisionGroup(players)
physicsService:RegisterCollisionGroup(debris)
game.Players.PlayerAdded:Connect(function(player)
local otherplayers = game.Players:GetPlayers()
table.remove(otherplayers,player.UserId)
for i, otherplayer in pairs(otherplayers) do
otherplayer.CharacterAdded:Connect(function(character)
for i, characterpart in pairs(character:GetChildren()) do
if characterpart:IsA("BasePart") then
characterpart.CollisionGroup = players
end
end
end)
end
end)
debrisFolder.ChildAdded:Connect(function(child)
child.CollisionGroup = debris
end)
physicsService:CollisionGroupSetCollidable(players, debris, false)
Side note: this is my first devforum post, so if you have any tips or changes you’d like me to make, feel free to share your feedback.