Clonning object into a player and moving it

Basically I am making a script for a shield. After played pressed G it should clone the object to the player’s arm, move it to the arm coordinates and weld it. It does that perfectly, what I am stuck with is moving Shield slightly to the edge of the arm. If I won’t, it will be in the center, but I need it to be at the left side of the left arm. If I do “+Vector3.new(0, 0, .6)” it will move it, but only if player is faced into the right direction. If while activating player is faced to the opposite direction, it will be different from what I want.
Without “+Vector3.new(0, 0, .6)”:
https://gyazo.com/6608fbe460b5b5fc5a63b306b28e6a92

With “+Vector3.new(0, 0, .6)” but without player moving after spawn(That’s how I want it):
https://gyazo.com/fa9ed38b051ce7a1e4c04569e9ae19bd

With “+Vector3.new(0, 0, .6)” but player moved before activating:
https://gyazo.com/bfec88e659f6aad0f85859bdbdaa65c2

Server script:

local arm = plr.Character:WaitForChild("Left Arm")
			local clone = shieldModel:Clone()
			clone.ShieldHitBox.Anchored = false
			clone.Parent = arm
			clone.ShieldHitBox.CFrame = arm.CFrame + Vector3.new(0, 0, .6) -- Main problem
			clone.ShieldHitBox.WeldConstraint.Part0 = arm

I understand that I somehow need to move it not with the global coordinates, but within arm coordinates. Though I don’t know how. Appreciate any help.

You could make it a tool and adjust the tool grip in tool grip editor, and you could make it so that when you press G the tool is parented to the character.

First of all, it should be on the left arm and move with it. And I don’t need as a tool, as it should work with other tools equipped.

I belive it would be better if you used welds, instead of WeldConstraints.

local arm = plr.Character:WaitForChild("Left Arm")
local clone = shieldModel:Clone()
clone.ShieldHitBox.Anchored = false
clone.Parent = arm

local Weld = Instance.new("Weld")
Weld.Parent = clone
Weld.Part0 = clone.ShieldHitBox
Weld.Part1 = arm
Weld.C0 = CFrame.new(.5,0,0)

My studios bugging out, so I can’t test the script. Let me know if it does or doesn’t work.

1 Like

Silly mistake, I forgot to parent the weld. Parent it to the clone.

1 Like

It worked! Thank you so much! Didn’t know Welds were different from WeldConstraints.

yep, they’re different. WeldConstraints will weld the 2 parts in the positions they’re currently in. Welds will force them together, no matter what position the 2 parts were in originally, and then apply the C0 as an offset to one of the parts.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.