Hey everyone, can someone tell me how to fix my fireball going sidewards when in shiftlock?
heres a video: Sideward bug - YouTube
Code:
local Players = game:GetService('Players')
local Player = Players.LocalPlayer
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local TweenService = game:GetService("TweenService")
local Debris = game:GetService("Debris")
local RunService = game:GetService("RunService")
-- * Directories
local Library = ReplicatedStorage:WaitForChild('Library')
local Modules = Library:WaitForChild('Modules')
local mfol_Effects = Modules:WaitForChild('Effects')
-- * GUI
local Jaws = Player.PlayerGui:WaitForChild('Main'):WaitForChild('Jaws')
-- * Modules
local mod_ComboFX = require(mfol_Effects:WaitForChild('ComboFX'))
local Utils = require(script.Parent:WaitForChild("Utils"))
local Crater = require(ReplicatedStorage.Modules.Combat.CraterModule)
local Helper : table = require(ReplicatedStorage.Modules.Combat.VfxHelper)
local SFXs = Helper.SFXs["Moves"]
local SharedFunctions = require(Helper.Modules.SharedFunctions)
-- * Objects
local Camera = workspace.CurrentCamera
local Effects = ReplicatedStorage.Assets.Skills:WaitForChild("Fireball")
local R : Random = Random.new()
local RayParams = RaycastParams.new()
-- * Assignments
local handler = {}
-- Fires when player is casting something
function handler.Cast(player,target,tool,info,remote,objects) --player = self, target = caster, tool = skill name, info = skill dictionary, remote = damageRemote if necessary, objects = skil folder
local Info = info
if not target then
return
end
local mouse = player:GetMouse()
mouse.TargetFilter = player.Character
RayParams.FilterDescendantsInstances = {player.Character}
local targetCharacter = target.Character or target.CharacterAdded:wait()
if targetCharacter and targetCharacter:FindFirstChild('HumanoidRootPart') then
local HumanoidRootPart = target.Character.HumanoidRootPart
local Humanoid = target.Character.Humanoid
local RightArm = target.Character:FindFirstChild("Right Arm")
local ws = Humanoid.WalkSpeed
if target == player then
HumanoidRootPart.Anchored = true
targetCharacter.Humanoid.AutoRotate = false
targetCharacter:WaitForChild("PlayerStates"):SetAttribute("WalkSpeed", 0)
targetCharacter:WaitForChild("PlayerStates"):SetAttribute("RunSpeed", 0)
Humanoid.WalkSpeed = 0
end
local BurstRocks = Effects.BurstRocks:Clone()
BurstRocks.Parent = workspace
BurstRocks.A1.Rocks:Emit(15)
BurstRocks.CFrame = CFrame.lookAt(HumanoidRootPart.Position, mouse.Hit.Position) * CFrame.Angles(math.rad(-90),0,0)
coroutine.wrap(function()
task.wait(3)
BurstRocks:Destroy()
end)()
local Att = Instance.new("Attachment")
Att.Parent = targetCharacter.Head
Att.Position = Vector3.new(0,0,-(targetCharacter.Head.Size.X * 1.25))
for _, v in pairs(Effects.PhoenixFlowerRelease.A1:GetChildren()) do
v:Clone().Parent = Att
end
for _ = 1, 3 do
for _, v in pairs(Att:GetChildren()) do
v:Emit(v:GetAttribute("EmitCount"))
end
coroutine.wrap(SharedFunctions.SFX)(targetCharacter.HumanoidRootPart,SFXs.Ignite,true)
local Flower = Effects.Flower:Clone()
Flower.Parent = workspace.FX
Flower.CFrame = Att.WorldCFrame
Flower.CFrame = CFrame.lookAt(Att.WorldCFrame.Position,mouse.Hit.Position)
local Ring = Effects.Ring:Clone()
Ring.Parent = workspace.FX
Ring.Size = Vector3.new(2.5,5,2.5)
Ring.CFrame = Flower.CFrame * CFrame.Angles(math.rad(90),0,0)
local BV = Instance.new("BodyVelocity")
BV.Parent = Flower
BV.MaxForce = Vector3.one * math.huge
BV.Velocity = Flower.CFrame.LookVector * 100
Flower.CanTouch = true
local Ringtween = TweenService:Create(Ring,TweenInfo.new(0.3,Enum.EasingStyle.Exponential),{Size = Vector3.new(8.5,0,8.5),Transparency = 1,Color = Color3.fromRGB(255,146,103)})
Ringtween:Play()
coroutine.wrap(function()
Ringtween.Completed:Wait()
Ringtween:Destroy()
Ring:Destroy()
end)()
for _ = 1,5 do
local Beam = Effects.Beam:Clone()
Beam.Parent = workspace.FX
if R:NextInteger(1,2) == 1 then
Beam.Color = Color3.fromRGB(165,165,165)
else
Beam.Color = Color3.fromRGB(255,146,103)
end
Beam.Size = Vector3.new(1,2,1)
Beam.CFrame = Ring.CFrame * CFrame.new(R:NextNumber(-3.5,3.5),R:NextNumber(-1,1),R:NextNumber(-3.5,3.5))
Beam.CFrame *= CFrame.Angles(math.rad(180),0,0)
local Beamtween = TweenService:Create(Beam,TweenInfo.new(0.2,Enum.EasingStyle.Quad),{Size = Vector3.new(0,5,0),CFrame = Beam.CFrame * CFrame.new(0,8,0)})
Beamtween:Play()
local Endedbeam;Endedbeam = Beamtween.Completed:Connect(function()
Beam:Destroy()
Beamtween:Destroy()
Endedbeam:Disconnect()
end)
end
wait(0.2)
local conn = Flower.Touched:Connect(function(hit)
if hit.Parent ~= targetCharacter then
BV:Destroy()
Flower.Anchored = true
Flower.Light:Destroy()
for _, v in pairs(Flower.A1:GetChildren()) do
v.Enabled = false
end
local Hit = Effects.Hit:Clone()
Hit.Parent = workspace.FX
Hit.CFrame = CFrame.lookAt(Flower.Position,mouse.Hit.Position)
for _, v in pairs(Hit:GetDescendants()) do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
local HitRing = Effects.Ring:Clone()
HitRing.Parent = workspace.FX
HitRing.Size = Vector3.new(2.5,5,2.5)
HitRing.CFrame = CFrame.lookAt(Flower.Position,mouse.Hit.Position) * CFrame.Angles(math.rad(90),0,0) * CFrame.new(0,-1,0)
local HitRingtween = TweenService:Create(HitRing,TweenInfo.new(0.5,Enum.EasingStyle.Exponential),{Size = Vector3.new(20,0,20),Transparency = 1,Color = Color3.fromRGB(255,146,103)})
HitRingtween:Play()
HitRingtween:Destroy()
local Lighttween = TweenService:Create(Hit.Light,TweenInfo.new(0.5,Enum.EasingStyle.Quart),{Brightness = 0})
Lighttween:Play()
Lighttween:Destroy()
Crater.new(CFrame.new(Flower.Position) * CFrame.new(0,1,0),9 / 1.5,Vector3.one * 1.25,5)
Crater.new(CFrame.new(Flower.Position) * CFrame.new(0,1,0),13 / 1.5,Vector3.one * 2,3)
game.ReplicatedStorage.Remotes.UpdateMousePos:FireServer(mouse.Hit.Position)
local HitDust = Effects.JumpDust:Clone()
HitDust.Parent = workspace.FX
HitDust.CFrame = CFrame.lookAt(Flower.Position,mouse.Hit.Position)
HitDust.Dust.LightEmission = -0.15
HitDust.Dust.Speed = NumberRange.new(60,70)
HitDust.Dust.Lifetime = NumberRange.new(1.5,3)
HitDust.Dust.Color = ColorSequence.new(hit.Color)
HitDust.Dust:Emit(35)
coroutine.wrap(SharedFunctions.SFX)(Hit,SFXs.Explosion,true)
coroutine.wrap(function()
task.wait(5)
Hit:Destroy()
Flower:Destroy()
Att:Destroy()
HitDust:Destroy()
HitRing:Destroy()
end)()
script.StopDetectTouch:Fire()
end
end)
script.StopDetectTouch.Event:Connect(function()
conn:Disconnect()
end)
task.wait(0.05)
end
HumanoidRootPart.Anchored = false ---
targetCharacter.Humanoid.AutoRotate = true ---
targetCharacter:WaitForChild("PlayerStates"):SetAttribute("WalkSpeed", Info.WalkSpeed) --
targetCharacter:WaitForChild("PlayerStates"):SetAttribute("RunSpeed", Info.RunSpeed) ---
Humanoid.WalkSpeed = Info.WalkSpeed--
end
end
return handler
Please wait until you see the fireball go sideward in the video.