so, I finally made a fireball that launched perfectly when I press the "e" key, but I do not know how to make it do damage when it hits other players. I tried doing it but it doesnt work, and whenever I walk or run while launching it, it launches diagonally down... I do not know why.. Can someone help me so that even when im running or walking, it launches straight infront of me? Can someone pls help me?
local Player = game.Players.LocalPlayer
local char = Player.Character or Player.CharacterAdded:Wait()
local head = char:WaitForChild("Head")
local x = Instance.new("Part")
x.BrickColor = BrickColor.new("Maroon")
x.Shape = "Ball"
x.Material = "Neon"
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.Anchored = false
x.CanCollide = false
x.Transparency = 0.5
x.Size = Vector3.new(3,3,3);
local y = Instance.new("Fire")
y.Size = 15
y.Heat = 5
game:GetService("UserInputService").InputBegan:connect(function(input)
if input.KeyCode == Enum.KeyCode.E then
local cl = x:Clone()
local cly = y:Clone()
local v = Instance.new("BodyVelocity")
v.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
v.Velocity = Player.Character.UpperTorso.CFrame.lookVector * 60
v.Parent = cl
cly.Parent = cl
cl.Parent = game.Workspace -- You forgot to Parent it
cl.Position = head.Position + (head.CFrame.lookVector * 5)
game.Debris:AddItem(cl, 4)
-- Position of head + push it in the direction the
-- player is looking and * 2 away from the player
end
end)
x.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 20
end
end)

2 comments
It did not work.. but I did realize that the reason for my fireball going down was because of CanCollide, i put the CanCollide equals to false although it was supposed to be true.. haha. but I shall accept ur answer! TY
Thanks!