Hello there!
So there is an issue with one of the ability of a sword I’m currently making. Said ability is a simple fireball ability. The issue however is that the fireball seems to move towards the mouse but not as I wanted it to as seen in the video below:
If you haven’t spot it, then here’s a diagram of what’s happening.
What I’m trying to do is make the fireball act as a generic projectile in any 2D game although when I test it, it will shrink because it’s actually doing moving further away from the player.
local FireBallAnim = Humanoid.Animator:LoadAnimation(Tool.FireballSummon)
FireBallAnim:Play()
FireBallAnim:GetMarkerReachedSignal("SummonFireBall"):Connect(function()
local FireBall = Instance.new("Part",workspace)
FireBall.CFrame = plr.Character["Left Arm"].CFrame + Vector3.new(0,-2,0)
FireBall.Shape = Enum.PartType.Ball
FireBall.Material = Enum.Material.Neon
FireBall.BrickColor = BrickColor.new("Neon orange")
FireBall.Size = Vector3.new(0.1,0.1,0.1)
FireBall.CanCollide = false
local WeldContraint = Instance.new("WeldConstraint",FireBall)
WeldContraint.Part0 = FireBall
WeldContraint.Part1 = plr.Character["Left Arm"]
--//Tweening
local Tweeninfo = TweenInfo.new(
.50,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out
)
local Tween = game:GetService("TweenService"):Create(FireBall,Tweeninfo,{Size = Vector3.new(2,2,2)})
Tween:Play()
FireBallAnim:GetMarkerReachedSignal("ThrowFireBal"):Connect(function()
WeldContraint:Destroy()
FireBall.Anchored = true
local Tweeninfo = TweenInfo.new(
3,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out
)
local Tween = game:GetService("TweenService"):Create(FireBall,Tweeninfo,{Position = MousePos})
Tween:Play()
Tween.Completed:Wait()
FireBall:Destroy()
end)