I'm trying to animate an arm coming out of the player but the problem is when i move its getting left behind anyway how to fix this?
here's my code;
local NewWeld = Instance.new("WeldConstraint")
NewWeld.Part0 = Player.Character['HumanoidRootPart']
NewWeld.Part1 = arm.PrimaryPart
NewWeld.C0 = CFrame.new()
NewWeld.C1 = arm.PrimaryPart.CFrame:toObjectSpace(Player.Character['HumanoidRootPart'].CFrame)
NewWeld.Parent = arm
NewWeld.Name = "HandleWeld"
local CFrameValue = Instance.new("CFrameValue")
CFrameValue.Value = arm:GetPrimaryPartCFrame()
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Circular, Enum.EasingDirection.Out)
CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
arm:SetPrimaryPartCFrame(CFrameValue.Value)
end)
local tween = TweenService:Create(CFrameValue, tweenInfo, {Value = arm:GetPrimaryPartCFrame()*CFrame.new(0,-2,0)})
tween:Play()
tween.Completed:Connect(function()
CFrameValue:Destroy()
for _,v in pairs (arm:GetChildren()) do
if v:IsA("BasePart") then
local tweenInfo = TweenInfo.new(.5, Enum.EasingStyle.Circular, Enum.EasingDirection.Out)
local Goal = {}
Goal.Transparency = 1
local Tween2 = TweenService:Create(v, tweenInfo, Goal)
Tween2:Play()
Tween2.Completed:Connect(function()
arm:Remove()
end)
end
if v:FindFirstChildWhichIsA("Decal") or v:FindFirstChildWhichIsA("Texture") then
for _, t in pairs(v:GetChildren()) do
if v:IsA("Decal") or v:IsA("Texture") then
local tweenInfo = TweenInfo.new(.5, Enum.EasingStyle.Circular, Enum.EasingDirection.Out)
local Goal = {}
Goal.Transparency = 1
local Tween3 = TweenService:Create(t, tweenInfo, Goal)
Tween3:Play()
end
end
end
end
end)
