So i’m having this issue where my bar isn’t straight it just follows a straight line from the hand
local function CreateBar(Self, Character)
local NewBar = Self.Bar:Clone()
NewBar.Parent = Character
for i, v in pairs(Self.Bar:GetChildren()) do
v.Transparency = 1
end
for i, v in pairs(NewBar:GetChildren()) do
v.Anchored = false
v.CanCollide = true
end
NewBar.Name = "LiftingBar"
local weld = Instance.new("Weld")
weld.Parent = NewBar
weld.Part0 = Character.RightHand
weld.Part1 = NewBar.PrimaryPart
weld.C0 = CFrame.new(-1.5, -0, 0)
end
Here’s my bar create script where it welds and stuff.
A raycast should do the trick really. Have a attachment or part from the left and right side of the bar, and raycast right to left. If you have no knoledge of raycasting, a gun tutorial does the trick since they tell you how to have the main bullet on the raycast. So have the bullet be the bar, dont stretch it, and have it looping the raycast until its finished.
You could re-animate your animation to have the arms straight instead of being slightly rotated, since you are welding your bar to one hand you would need to make sure the hands are parallel with each other.
local dir = (Character.RightHand.CFrame:Inverse() * Character.LeftHand.CFrame.p)
weld.C0 = CFrame.fromMatrix(0.5*dir, dir.Unit, Vector3.yAxis)
This is making some assumptions about the orientations of your character’s parts, and that long axis of the bar is the bar part’s X axis. If the bar ends up moving away from the left hand, change the sign of 0.5 * dir to -0.5 * dir. If the bar ends up at a right angle of how it should be, let me know, I can tell you how to correct that too.