For context I’m making a game that uses weapons currently I’m using a weld (for now, later I will change it to joint for animations) and I need to change the position of the weapon to the player hand with an offset. However then using SetPrimaryPartCFrame an error shows this
Invalid argument #2 (Vector3 expected, got CFrame)
This is weird because I thought it needed an CFrame and not a Vector3? As it says Set CFrame.
Is this a bug, something wrong with my code or bug at roblox’s end?
Here is the code
local function WeaponON()
ChoosenWeapon.Parent = Char
ChoosenWeapon:SetPrimaryPartCFrame(CFrame.new(RightArm.CFrame + WeaponsInfo.WeaponOffSet[ChoosenWeapon.Name]))
NewWeld(RightArm,ChoosenWeapon)
end
ANd here is how the weld is create (currently causing no issues)
local function NewWeld(part0,part1)
local NewWeld = Instance.new("WeldConstraint")
NewWeld.Part0 = part0
NewWeld.Part1 = part1
NewWeld.Parent = part0
end
This is the moduleScript storing the data for weapons Offsets ( but there is currently only one weapon)
module.WeaponOffSet = {
["Basic"] = CFrame.new(0,0,-1)
}
Any insight would be very helpful and thank you.
(btw I very much know I can use tools instead, however I would like to do this instead because I want it part of the character and not to show up in the player hotbar without disabling the hotbar)