I am attempting to create a fireball effect that is created when player activates their sword.
See below.
As seen, the blaze shoots out multiple flames at different seconds.
I tried to attempt this with my code, but it still does not replicate the same behaviour.
function fireAbility()
tickB = tick();
local mouseloc = uis:GetMouseLocation()
local origin = camera:ViewportPointToRay(mouseloc.X, mouseloc.Y)
local raycastparams
for i, v in pairs(game.Players:GetPlayers()) do
if v.Name ~= Player.Name then
table.insert(IgnoreList, v)
local character = v.Character
ignoreAccessories(character)
raycastparams = RaycastParams.new()
raycastparams.FilterDescendantsInstances = {IgnoreList}
raycastparams.FilterType = Enum.RaycastFilterType.Include;
local handPosition = Sword:WaitForChild("Handle").Position
local direction = (mouse.Hit.Position - handPosition).Unit * 30
local ray = workspace:Raycast(origin.Origin, origin.Direction * 1000, raycastparams)
local part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
part.Position = origin.Origin + (origin.Direction.Unit * 5)
part.Parent = workspace
part.Size = Vector3.new(1,1,1)
local part2 = Instance.new("Part")
part2.Anchored = true
part2.CanCollide = false
part2.Position = origin.Origin + (origin.Direction.Unit * 5)
part2.Parent = workspace
part2.Size = Vector3.new(1,1,1)
local part3 = Instance.new("Part")
part3.Anchored = true
part3.CanCollide = false
part3.Position = origin.Origin + (origin.Direction.Unit * 5)
part3.Parent = workspace
part3.Size = Vector3.new(1,1,1)
local tweenInfo = TweenInfo.new(
0.6, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local tweenInfo2 = TweenInfo.new(
1.5, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local tweenInfo3 = TweenInfo.new(
1, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local tween = TweenService:Create(part, tweenInfo, { Position = origin.Origin + (origin.Direction.Unit) * 50})
local tween2 = TweenService:Create(part2, tweenInfo2, { Position = origin.Origin + (origin.Direction.Unit) * 50})
local tween3 = TweenService:Create(part3, tweenInfo3, { Position = origin.Origin + (origin.Direction.Unit) * 50})
tween:Play()
tween2:Play()
tween3:Play()
My attempt below: