local event = script.Parent.Shoot
local dropRight = script.Parent.DropRight
local rightHand = script.Parent.HandR
local TS = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local RightAttached = false
local LeftAttached = false
local Rightdebounce = false
local PartRightTouch
local PartLeftTouch
local weld = script.Parent.HandR.Grab
local inAnimation = false
event.OnServerEvent:Connect(function(player, side, target)
print(side, RightAttached, Rightdebounce)
if side == "Right" and RightAttached == false and Rightdebounce == false and inAnimation == false then
print("first")
local tweenToTarget = TS:Create(rightHand, tweenInfo, {Position = target})
inAnimation = true
tweenToTarget:Play()
tweenToTarget.Completed:Wait()
inAnimation = false
rightHand.Touched:Connect(function(hit)
if hit and hit:IsA("BasePart") and not Rightdebounce then
if hit.Anchored == false then
weld.Part0 = hit
hit.Massless = true
hit.CanCollide = false
Rightdebounce = true
PartRightTouch = hit
else
local tweenBack = TS:Create(script.Parent.HandR, tweenInfo, {Position = script.Parent.PosR.Position})
inAnimation = true
tweenBack:Play()
tweenBack.Completed:Wait()
inAnimation = false
Rightdebounce = false
end
end
end)
elseif side == "Right" and RightAttached == false and Rightdebounce == true and inAnimation == false then
print("second")
RightAttached = true
local tweenBack = TS:Create(script.Parent.HandR, tweenInfo, {Position = script.Parent.PosR.Position})
inAnimation = true
tweenBack:Play()
tweenBack.Completed:Wait()
inAnimation = false
end
end)
dropRight.OnServerEvent:Connect(function()
if inAnimation == true then return end
if PartRightTouch then
PartRightTouch.CanCollide = true
PartRightTouch.Massless = false
weld.Part0 = nil
local partPos = rightHand.Position
PartRightTouch.Position = partPos
RightAttached = false
PartRightTouch = nil
end
task.wait(1)
Rightdebounce = false
end)
I have this code, problem is when it grabs a part, it grabs it from the middle of it, which for larger parts will cause it to be inside the players character when you pull it back. This can be fixed using weld constraints instead of regular weld which the “Grab” object currently is, however that would make it so that I cant tween the Hand when something is welded to it as tweening Position does not move welds along with it and tweening CFrame which i tried many times in many different ways does not work.
I would like to know how I can make it weld not to the middle of the part that it hits but to where in the part it actually hits without making it impossible to tween as in the case of weld constraints
any help is appreciated