The goal of my script is to weld a knife, gun, and radio to the side of the player’s character.
R6 weld works perfectly. However, when I do the R15 weld, the parts do not welde and fall through the baseplate (they are non-collidable). So basically my problem is parts not welding to R15 LowerTorso and UpperTorso.
Here is my script:
local function Weld(a,b)
local Weld = Instance.new("Weld")
Weld.Part0 = a
Weld.Part1 = b
Weld.C0 = CFrame.new()
Weld.C1 = b.CFrame:inverse() * a.CFrame
Weld.Parent = a
end
Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character)
local Equipped = _G.DataManager.PlayerGetEquipped(Player)
local EquippedKnife = Equipped.Knife
local EquippedGun = Equipped.Gun
local EquippedRadio = Equipped.Radio
local Knife = GetKnife(EquippedKnife)
local Gun = GetGun(EquippedGun)
Knife.Parent = Character
Gun.Parent = Character
if Character:FindFirstChild("LowerTorso") then
Knife.CFrame = Character:FindFirstChild("LowerTorso").CFrame * CFrame.new(0.9,-0.1,0) * CFrame.Angles(math.rad(135),math.rad(180),0)
Gun.CFrame = Character:FindFirstChild("LowerTorso").CFrame * CFrame.new(-0.9,-0.1,0) * CFrame.Angles(math.rad(135),0,0)
Weld(Character:FindFirstChild("LowerTorso"),Knife)
Weld(Character:FindFirstChild("LowerTorso"),Gun)
else
Knife.CFrame = Character:FindFirstChild("Torso").CFrame * CFrame.new(0.9,-1,0) * CFrame.Angles(math.rad(135),math.rad(180),0)
Gun.CFrame = Character:FindFirstChild("Torso").CFrame * CFrame.new(-0.9,-1,0) * CFrame.Angles(math.rad(135),0,0)
Weld(Character:FindFirstChild("Torso"),Knife)
Weld(Character:FindFirstChild("Torso"),Gun)
end
if _G.DataManager.PlayerHasItem(Player,"Radio","Default") then
local Radio = GetRadio(EquippedRadio)
Radio.Parent = Character
if Character:FindFirstChild("UpperTorso") then
Radio.CFrame = Character:FindFirstChild("UpperTorso").CFrame * CFrame.new(0,-0.1,0.8) * CFrame.Angles(0,math.rad(180),math.rad(45))
Weld(Character:FindFirstChild("UpperTorso"),Radio)
else
Radio.CFrame = Character:FindFirstChild("Torso").CFrame * CFrame.new(0,0,0.8) * CFrame.Angles(0,math.rad(180),math.rad(45))
Weld(Character:FindFirstChild("Torso"),Radio)
end
end
end)
end)
Thanks for reading and please reply any suggestions that you have that could possibly help me. Have a good day/night!
- Galactiq