[SOLVED] how would i be able to put a melee handle in a player back when they unequip a tool?

So, i was rewriting vec’s melee system V2 to make a V2.1 version with a cleaner code and more optimized code, and i ended up deciding to remake the back accessory code. Basically, when you unequip the melee, a accessory should appear in your back, but i didnt liked the method that i was using(cloning a accessory from serverstorage with the same name as a tool in your character and then deleting it when you equip the tool), so how id be able to make the melee handle stand on the character back when you unequip it? Example image of what im talking about:

1 Like

Simply clone the weapon you want of the players back, weld it to their back, set its transparency to 1 when the tool is equipped, and to 0 when unequipped.

2 Likes

I still failing at trying to cframe to the player’s back.

Can you show me the code???

1 Like

unequipped code:

if setting.showAccessories then
	if not char.Torso:FindFirstChild('tool_back') then
		local tool_back = handle:Clone()
		tool_back.Transparency = 1
		tool_back.Name = 'tool_back'
		tool_back.Parent = char.Torso
		local weld = Instance.new('Motor6D')
		weld.Part0 = tool_back
		weld.Part1 = char.Torso
		weld.C0 = CFrame.new(char.Torso.CFrame.LookVector*.5)-- *CFrame.Angles(1.5,1.5/2,0)
		weld.Parent = char.Torso
	end
	if char.Torso:FindFirstChild('tool_back') then
		char.Torso.tool_back.Transparency = 0
	end
end

equipped code:

if char.Torso:FindFirstChild('tool_back') then
	char.Torso.tool_back.Transparency = 1
end

I also tried using welds but the result was the same.

is showAccessories is a bool value??

1 Like

It dont matters, im having trouble with the cframing.

srry for the late reply did u tried using CFrame.Angles?

1 Like

yes i did
image

if u wn to rotate the tool u should add math.rad() so roblox code can actually transform it to degrees

CFrame.Angles(math.rad(45 – degrees ),0,0) – Example

1 Like