I have a simple-ish script making the player shoot fireballs when clicked, the fireball just gets the rootparts position and fires it out of the torso but it only flys out and is not aim-able how would I make it aim-able? Do you have to use mouse.hit.p? halp also how would I make it so the fireball despawns and it doesn't effect the debounce wait
local tool = script.Parent
local anim = tool:WaitForChild('Burst')
local plyr = game:GetService('Players').LocalPlayer
local mouse = plyr:GetMouse()
local char = plyr.Character
local firesound = tool:WaitForChild('Sound')
local explosion = tool:WaitForChild('Sound2')
local human = char:WaitForChild('Humanoid')
local rootpart = char:WaitForChild('HumanoidRootPart')
local debounce = false
function creation()
local brick = Instance.new('Part', workspace)
brick.Anchored = true
brick.Size = Vector3.new(4,4,4)
brick.CanCollide = false
brick.Material = 'Neon'
brick.BrickColor = BrickColor.new('Bright red')
brick.Orientation = rootpart.Orientation
brick.Position = rootpart.Position + Vector3.new(0,1,0)
local mesh = Instance.new('SpecialMesh', brick)
mesh.MeshType = 'Sphere'
local vel = Instance.new("BodyVelocity")
vel.velocity = rootpart.CFrame.lookVector * 150
vel.maxForce = Vector3.new(4e+005,4e+005,4e+005) * 10000 -- pushbackmount
vel.Parent = brick
brick.Anchored = false
end
local active = false
tool.Activated:connect(function()
if debounce == false then
debounce = true
active = true
local f = firesound:Clone()
f.Parent = rootpart
f:Play()
local animation = human:LoadAnimation(anim)
animation:Play()
creation()
wait(.2)
f:Destroy()
wait(.5)
debounce = false
active = false
end
end)

2 comments
a easier way to get the local plyer is "game.Players.LocalPlayer"
^ makes me feel better with game:GetService