Now, I’m in no way the best, and in no way very good at object oriented programming, but I needed a custom tool system using welds and motor6ds and I found no solutions, so I tried my best to make one, and this is what I came up with! I’m making it public due to other people struggling with this/having to use accessories for tool holstering which is really annoying, having to create an accessory for every tool.
I am inexperienced at OOP and this will not be the best or most optimal, and you may have to edit it to fit your game style, please tell me if any bugs occur or if you know a way to further optimize the script.
Weapons require a Handle for now, but it has to be a model and not directly in the tool. Make sure to turn RequiresHandle off.
• GET HOLSTERSERVICE
Example of use (Server-Script):
local tool = script.Parent
local plr = tool.Parent.Parent
local char = plr.Character or plr.CharacterAdded:Wait()
local holsterService = require(game.ReplicatedStorage.HolsterService)
holsterService.SetLibrary(game:GetService("ServerStorage"):FindFirstChild("WeaponModels")) -- Where your weapons are stored, it will automatically default to what I put here
local weapon = holsterService.createWeapon("Sword", char) -- Make sure that the string is the weapon model and that it's in your library, and char is the model you want to hold the weapon
weapon:Holster("Torso", CFrame.new(-1, -1, -1)) -- Arg 1 is the part of the model you want the weapon to weld to, Arg 2 is the C0
script.Parent.Equipped:Connect(function()
weapon:Sheath("Right Arm", char["Right Arm"].RightGripAttachment.CFrame * CFrame.Angles(math.rad(180), 0, 0)) -- Arg 1 is the part of the model you want the weapon to weld to, Arg 2 is the C0
end)
script.Parent.Unequipped:Connect(function()
weapon:Holster("Torso", CFrame.new(-1, -1, -1))
end)
The library and weapon module should be setup along the lines of this
But you’re always able to change the module to something that fits your game.
This is basic use, and yes I know the module is lacking in functionality and stuff, It’s just a basic use for welding tool models to characters and stuff. I can’t provide an example video yet as my obs keeps crashing, I’ll update with one soon.
Major-ish Updates:
(im not just putting small tweaks here)