hello, so i am trying to make a script that whenever you unequip a sword(tool) it welds to your back, i found a way to create a clone of the tool but when i try to move the CFrame of that clone (so i can make it go on the players back) the player moves to that swords new CFrame (https://gyazo.com/c0a118b444861c619be5944f56f6dc6f the player moves to the sword)
Full Script:
local onback = false
local UIS = game:GetService("UserInputService")
function BackWeld() --item must be in inventory
if not onback then
local player = script.Parent.Parent.Parent.Parent
local char = player.Character
local upperT = char.UpperTorso
local toolclone = script.Parent.Parent:Clone()
toolclone.Parent = game.Lighting.OnbackFolder
toolclone.Name = 'OnbackClone'
local clonechildren = toolclone:GetChildren()
local model = Instance.new('Model',char)
model.Name = 'SwordForBack'
for i = 1 , #clonechildren do
if clonechildren[i].ClassName == 'Part' or clonechildren[i].ClassName == 'MeshPart' then
local ultraclone = clonechildren[i]
ultraclone.Name = clonechildren[i].Name
ultraclone.Parent = model
ultraclone.CanCollide = false
if clonechildren[i].Name == 'Handle' then
for i,v in pairs(model:GetChildren()) do
if v:IsA('MeshPart','Part') then
local Weld = Instance.new('Weld', model)
Weld.C0 = model.Handle.CFrame:inverse() * v.CFrame
Weld.Part0 = model.Handle
Weld.Part1 = v
end
end
end
end
end
local modelhandle = model.Handle
local backWeld = Instance.new('Weld', modelhandle)
backWeld.Name = 'Backweld'
backWeld.Part0 = upperT
backWeld.Part1 = modelhandle
modelhandle.CFrame = upperT.CFrame + Vector3.new(10,0,10)
end
end
script.Parent.Parent.Unequipped:Connect(function()
print('Activated')
BackWeld()
wait(1)
end)
the part of the script that i think matters is:
local modelhandle = model.Handle
local backWeld = Instance.new('Weld', modelhandle)
backWeld.Name = 'Backweld'
backWeld.Part0 = upperT
backWeld.Part1 = modelhandle
modelhandle.CFrame = upperT.CFrame + Vector3.new(10,0,10)
because i think this is because i need to use a different weld but a weld constraint also doesn't work so whenever i move the 'modelhandle.CFrame' the player moves with it
if anything is unclear comment i'll try and explain it better

2 comments
maybe the weld is forcing the character CFrame somewhere else, maybe you could try swapping P0 and P1?
i tried that but the same thing happens