Thanks for responding. After testing, it actually did solve half of the issue, thanks! Now, My next issue is that I don’t know how i’d approach rotating / moving the weapons while keeping their position the same. my previous script did this but caused the issue above too so how would I approach this correctly?
As seen, the sword retains its correct position but in an undesired way
It is a single mesh, I should’ve clarified that, apologies, but it does have a few parts as children (the parts emitting particles) so i figured it also counts as a model
alright!
i think using animations would work well.
just have 1 animation where the sword is is unequipped (presumably at the back), and 1 animation holding the sword.
to animate it, copy your character when the sword is unequipped (the sword attached the torso) and copy your character when the sword is equipped (the sword attached to the right arm).
make sure you set the animation priority to “action” or higher(i cant tell you enough how many times i’ve messed this up)
if you would prefair the sword to actually be rotated manually with code or have any issues, lemme know!
rotating (and correctly positioning) the sword manually with code would be easiest to do with attachments.
you could make one attachment on the bottom of the right arm (since this is R6) for when the sword is equipped, and one at the back of the torso for when it is not.
i know you are using a custom rig, so adding the attachments is as simple as positioning and rotating the sword and then copy and pasting the position and orientation into an attachment parented to the arm/torso. (make sure you are copying into the WorldPosition and WorldOrientation properties and not the regular Position and Orientation properties.)
im not entirely sure how you are positioning the sword currently, but if you are still using welds, i think you can set the C1(presuming thePart1property of your weld is the sword) to the CFrame of the unequipped/equipped attachment.
to change the sword between being unequipped and equipped, you can use this:
local torsoAttach = char.Torso.SwordAttach --Used when unequipped
local handAttach = char.RightArm.SwordAttach --Used when equipped
--[[ Sword is Unequipped ]]--
SwordWeld.C1 = torsoAttach.CFrame
--[[ Sword is Equipped ]]--
SwordWeld.C1 = handAttach.CFrame
using animations would probably be overall better in this case, but either will probably work the same .
I am welding parts to different parts of the player then applying an offset to them so they are positioned where I want then setting the sword’s Position to those when needed, but I can just add attachments to these parts and have the sword act on those like you said. (these will be invisible when I’m done with them)
I’ll return after I implement what you have suggested and see how it goes, thanks!
Apprently I can’t assign Attachments or their properties to welds (their Part0/1 proprery), they return with errors, according to the errors, welds can only attach to objects / baseparts
i see…
the fact that you have parts where you want the swords position makes it ALOT easier.
you could just set the SwordWeld C1 as the same as (for example the right arm’s part’s weld)'s C1 instead.
then you don’t need anything extra!
let me know if this works again, because im not entirely sure why it wouldn’t allow you to set the C1 of a weld to the CFrame of an attachment.
good luck!
The method I find is the best for this is taking advantage of the player’s attachments. You can use the attachments on a player’s character to attach models to the character model, then welding each of model’s parts together and unanchoring them. For a better understanding I left this reply that best explains this concept:
I’ll try this, thanks! just out of curiousity, can I make my own attachments also? If so, I can replace the proxies with Attachments instead since this seems to be more suitable for what i’m doing
I see, I was reading somewhere earlier that WeldConstraints were the “newer” alternative to welds, so I presumed they worked the same, what’s the differences other than what’s listed?
WeldConstraints are alot easier because all you need is 2 parts and that’s it, but with welds, you can set offset values, which would work better in this case.