Hello there! I’ve been trying to work on my own weapon system using this tutorial as a guide for the animation portion; How to animate Tool Parts (Guns, Knifes etc.)
Everything is going well, but for some ungodly reason when I equip the tool the welded part or in this case ‘blade’ auto-deletes after use! I have no idea what’s causing this, and to clarify. The only scripts in this baseplate is the local script handling the welding.
For some reason, it doesn’t do this with a normal part? But with the mesh katana I use it does.
Here are some gyazos with the two tools, hope it adds some visual context.
https://gyazo.com/38fbf5e69988d35acbe31a2ddf2d2f6c
https://gyazo.com/a155f0936e237e3d461ab5dfd79b3ac5
This is the code for the blade
local rs = game:GetService("ReplicatedStorage")
local players = game:GetService("Players").LocalPlayer
wait()
local tool = script.Parent
local blade = tool.Blade
--local sheathe = tool.Sheathe
repeat wait() until players.Character
--//INITIAL WELD\\--
--TODO
--//EVENTS\\--
tool.Equipped:Connect(function()
local weld = Instance.new("Weld", blade)
weld.Name = "WeaponWeld"
weld.Part0 = blade
weld.Part1 = players.Character["Torso"]
weld.C0 = CFrame.new(-1, 1, -1.5)
weld.C0 = weld.C0 * CFrame.fromEulerAnglesXYZ(math.rad(0),math.rad(-90),0)
end)
tool.Unequipped:Connect(function()
blade.WeaponWeld:Destroy()
end)