So basically, I am trying to make the famous pistol attack from the gum gum fruit, and I just can’t seem to get it right. My problem is that I want the players arm to actually go to the mouse.Posistion instead of just launching forward but I don’t know how to make the Motor6D do that here is my script for the arm.
local PLAYER = game.Players:GetPlayerFromCharacter(Params.Character)
local NewArm = Instance.new("Part",Params.Character)
NewArm.Name = "Pistol"
NewArm.BrickColor = Params.Character["Left Arm"].BrickColor
NewArm.Material = "SmoothPlastic"
NewArm.Size = Vector3.new(1,2,1)
NewArm.CanCollide = false
local ArmMotor6 = Instance.new("Motor6D", Params.Character.Torso)
ArmMotor6.Part0 = Params.Character.Torso
ArmMotor6.Part1 = NewArm
ArmMotor6.C1 = CFrame.new(0.5,0.5,0) * CFrame.Angles(0,math.rad(-90),math.rad(90))
ArmMotor6.C0 = CFrame.new(-1,0.5,0) * CFrame.Angles(0,math.rad(-90),0)
Params.Character["Left Arm"].Transparency = 1
local FX = game.ReplicatedStorage.Assets.VFX.Luffy.Pistol:Clone()
FX.Parent = workspace.FX
FX.Pistol.CFrame = NewArm.CFrame * CFrame.new(0,-24,0) * CFrame.Angles(math.rad(-90),0,0)
for _, Particle in pairs(FX:GetDescendants()) do
if Particle:IsA("ParticleEmitter") then
Particle:Emit(Particle:GetAttribute("EmitCount"))
end
end
local Mouse = PLAYER:GetMouse()
local Position = Mouse.Hit.Position
local ArmTween
local Part = Instance.new("Part")
Part.Anchored = true
Part.Position = Position
Part.Size = Vector3.new(1,1,1)
Part.Parent = game.Workspace.FX
Part.BrickColor = BrickColor.new("Neon green")
if (Params.Character.HumanoidRootPart.Position - Position).Magnitude < 40 then
ArmTween = TweenService:Create(NewArm, TweenInfo.new(0.2, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out,0,true,0),{Size = Vector3.new(1,(Params.Character.HumanoidRootPart.Position - Position).Magnitude,1),})
ArmTween:Play()
-- ArmMotor6.CFrame
TweenService:Create(ArmMotor6, TweenInfo.new(0.2, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out,0,true,0),{C1 = CFrame.new(0.5,((Params.Character.HumanoidRootPart.Position - Position).Magnitude/2) -0.5,0) * CFrame.Angles(0,math.rad(-90),math.rad(90),Position)}):Play()
else
ArmTween = TweenService:Create(NewArm, TweenInfo.new(0.2, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out,0,true,0),{Size = Vector3.new(1,40,1),})
ArmTween:Play()
TweenService:Create(ArmMotor6, TweenInfo.new(0.2, Enum.EasingStyle.Cubic, Enum.EasingDirection.Out,0,true,0),{C1 = CFrame.new(0.5,19.5,0) * CFrame.Angles(0,math.rad(-90),math.rad(90))}):Play()
end
I also don’t know If I should use the players real arm or not, I have tried both and they both seem to work fine except for the players mesh arm kind of looks weird. VIDEO DOWN BELOW OF MY CODE:
As you can see It Works but It doesn’t go to the mouse.Hit.Position it only goes to its length or distance