I have a script and a local script all inside a tool, whenever the fireball shoots out the it aims more down than my mouse is.

SCRIPT

	local Tool = script.Parent
play = Tool.Parent.Parent 
char = play.Character
hum = char.Humanoid 
root = char.HumanoidRootPart

t = true
local en = true

Tool.unEquip.OnServerEvent:connect(function()
	t=false
	a1:Stop()
		char["Right Arm"].ParticleEmitter:Destroy()
	Tool.Handle.ParticleEmitter.Enabled = false
end)
 Tool.Equip.OnServerEvent:connect(function(play,mousehit) 
	local particle = Tool.Handle.ParticleEmitter:Clone()
		local arm = char["Right Arm"]
		particle.Parent = arm
		particle.Enabled = true
	t=true
	a1 = hum:LoadAnimation(Tool.Hold)
	
 a1:Play()
 

end)





Tool.RemoteEvent.OnServerEvent:connect(function(play,mousehit)

	
 local a = hum:LoadAnimation(Tool.Throw)
 a:Play()

 local fireball = Tool.Handle:clone()
 fireball.CFrame = char['Right Arm'].CFrame
 local bv = Instance.new("BodyVelocity")
 bv.MaxForce = Vector3.new(1e8,1e8,1e8)
 bv.Velocity = mousehit.lookVector * 80
 bv.Parent = fireball
fireball.ParticleEmitter.LockedToPart = false
 fireball.CanCollide = false
fireball.Transparency = .3
fireball.ParticleEmitter.Enabled = true
wait(.5)
 fireball.Parent = game.Workspace



 game.Debris:AddItem(fireball,4)
 local ten = true
 fireball.Touched:connect(function(hit)
 if not ten then return end
 ten = false
 local ehum = hit.Parent:findFirstChild("Humanoid") or hit.Parent.Parent:findFirstChild("Humanoid")
 if ehum and ehum ~= hum then
  ehum:TakeDamage(40)---------------------

   local part = fireball:clone()
   part.Size = Vector3.new(1,1,1)
   part.CFrame = fireball.CFrame
   part.ParticleEmitter:Destroy()
part.Anchored = true
   part.Parent = game.Workspace



local p = 2

while part.Size ~=Vector3.new(5,5,5) do
part.Size = Vector3.new(p,p,p)
p = p+1
wait(0.0001)
end
while part.Size ~=Vector3.new(2,2,2) do
part.Size = Vector3.new(p,p,p)
p = p-1
wait(0.0001)
end
fireball:Destroy()
part:Destroy()
wait(0.05)
fireball:Destroy()
 elseif hit.Anchored  == true and hit.CanCollide == true then

   local part = fireball:clone()
   part.Size = Vector3.new(1,1,1)
   part.CFrame = fireball.CFrame
   part.ParticleEmitter:Destroy()
part.Anchored = true
   part.Parent = game.Workspace



local p = 2

while part.Size ~=Vector3.new(5,5,5) do
part.Size = Vector3.new(p,p,p)
p = p+1
wait(0.0001)
end
while part.Size ~=Vector3.new(2,2,2) do
part.Size = Vector3.new(p,p,p)
p = p-1
wait(0.0001)
end
fireball:Destroy()
part:Destroy()
   game.Debris:AddItem(part,1)
 end



 wait()
 ten = true

 end)
end)

LOCAL SCRIPT

local Tool = script.Parent
play = game.Players.LocalPlayer
local mouse = play:GetMouse()

Tool.Unequipped:connect(function()
Tool.unEquip:FireServer(mouse.hit)
end)

Tool.Equipped:connect(function()
Tool.Equip:FireServer(mouse.hit)
end)

local en = true
Tool.Activated:connect(function()
 if not en then return end
 en = false

 Tool.RemoteEvent:FireServer(mouse.Hit)

 wait(1)

 en = true
end)

2 comments

0

Just did a quick glance over this and I can't find where your raycasting is

0

Use LookVector*100 to aim it properly.