Heyy, need some help here, so I’ve been trying to make a script that hang or erm welds a display knife to the player’s torso like Murder Mystery, here’s my code and it works well with normal torso but breaks with other type of torso.
function module:Knife(player)
local char = player.Character
local hand = game:GetService("ServerStorage"):WaitForChild("KnifeLeft"):clone()
hand.Parent = char
hand.CFrame = char:WaitForChild("LowerTorso").CFrame*CFrame.new(Vector3.new(1,-0.55,0.2))*CFrame.Angles(math.rad(15),math.rad(-180),math.rad(-180))
weldBetween(char:WaitForChild("LowerTorso"), hand)
hand.CanCollide = true
hand.Anchored = false
end
function weldBetween(a, b)
local weld = Instance.new("ManualWeld")
weld.Part0 = a
weld.Part1 = b
weld.C0 = CFrame.new()
weld.C1 = b.CFrame:inverse() * a.CFrame
weld.Parent = a
return weld
end
But this happens whenever other type of torso is equipped, sometimes the knife falls off (the knife in this picture(2nd pic) is a skin and it has probably has nothing to do with it because the same thing happens with every other skins)
The problem is not in the different, packaged torsos, but in the different skins.
Different torso are just meshed regular ones, so they are not affected.
Ah there it is. In your KnifeLeft you have LeftHipRigAttachment. That’s what I was thinking it might be. Remove those attachments and welds from the knife. When a character is created it looks for those attachments in order to weld things.
I made a mini tutorial on doing things like this. You can use my tutorial as a point of reference for your system, just change some names and positions around. You should, in fact, do it this way over hard-coded CFrame math so you can account for different avatar bundles which bring different hip positions.
Alright thanks, I will try this tomorrow as i’m going to sleep rn and finally I can sleep properly (hopefully xd) without my mind constantly thinking about a solution to a still unfixed bug that I’ve found and thinking about what else to do tomorrow, it’s hard being a developer and i’m tired, hopefully my game will come out to a success when it’s publicly released.
manually. By multiplying either C0 or C1 of the weld with CFrame Values.
Remember CFrame is tilted along with the object’s facing direction. CFrame.new(0,0,-1) to make it move forward, etc.
or make a tool yourself, by making two objects in a separate positions, then using a script to subtract the Knife part CFrame by the Part CFrame. local C0 = Knife.CFrame * Part.CFrame:inverse()