#Very Simple Code Not Working

10 messages · Page 1 of 1 (latest)

muted forum
#

Im tryna make a weldconstraint attach to the mainpart of this weapon model and the player's uppertorso, but the weld does not get created, i tried spamming it in the code and nothing happens, for some reason it just ignores the Instance.new('WeldConstraint') and I have no idea why.

function mod.CarryWeapon(character,weapon)
    local clone = game.ReplicatedStorage.Assets.WeaponModels[weapon]
    clone.Parent = character.HumanoidRootPart
    clone.Handle.Anchored = true

    local weld = Instance.new('WeldConstraint')
    weld.Parent = weapon.Handle
    weld.Part0 = weapon.Handle
    weld.Part1 = character.UpperTorso
    
    local offset = clone.Offset.Value
    local rot = clone.Rot.Value
    clone:PivotTo(character.PrimaryPart.CFrame * CFrame.new(offset.X,offset.Y,offset.Z) * CFrame.Angles(rot.X,rot.Y,rot.Z))
end

I'm sure im just overlooking something but any help is appreciated

sharp hinge
#
function mod.CarryWeapon(character,weapon)
  local clone = game.ReplicatedStorage.Assets.WeaponModels[weapon]
  clone.Parent = character.HumanoidRootPart
  clone.Handle.Anchored = true

  local weld = Instance.new('WeldConstraint')
  weld.Parent = clone
  weld.Part0 = clone.Handle
  weld.Part1 = character.UpperTorso

  local offset = clone.Offset.Value
  local rot = clone.Rot.Value
  clone:PivotTo(character.PrimaryPart.CFrame * CFrame.new(offset.X,offset.Y,offset.Z) * CFrame.Angles(rot.X,rot.Y,rot.Z))
end
muted forum
#

oh

#

wow

sharp hinge
#

you didn't assign it to the cloned weapon

muted forum
#

im dum 💀

#

how did I not see that

#

thaks

sharp hinge
#

lmao