I don't know how to make my fireball to shoot in my mouse direction, maybe someone can help me.
Code:
local Player = game.Players.LocalPlayer
local char = Player.Character or Player.CharacterAdded:Wait()
local head = char:WaitForChild("Head")
local shot = 1
local textura = "rbxassetid://413371174"
local x = Instance.new("Part")
x.BrickColor = BrickColor.new("White")
x.Shape = "Ball"
x.Material = "Neon"
x.TopSurface = "Smooth"
x.BottomSurface = "Smooth"
x.Anchored = false
x.CanCollide = false
x.Transparency = 0
x.Size = Vector3.new(40,40,40);
x.Name = "BilaX"
local y = Instance.new("Part")
y.BrickColor = BrickColor.new("Really red")
y.Shape = "Ball"
y.Material = "Neon"
y.TopSurface = "Smooth"
y.BottomSurface = "Smooth"
y.Anchored = true
y.CanCollide = false
y.Transparency = 0.4
y.Size = Vector3.new(100, 100, 100);
y.Name = "BilaY"
local z = game.StarterPack.Fireball.ParticleEmitter
z.Texture = textura
z.Parent = y
game:GetService("UserInputService").InputBegan:connect(function(input, mouse)
if input.KeyCode == Enum.KeyCode.R then
if shot == 1 then
local cl = x:Clone()
local v = Instance.new("BodyVelocity")
v.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
v.Velocity = Player.Character.Torso.CFrame.lookVector * 110
v.Parent = cl
cl.Parent = game.Workspace
cl.CFrame = Player.Character.Torso.CFrame * CFrame.new(0,1,-30)
shot = 0
wait(1)
if game.Workspace:FindFirstChild("BilaX") then
local cly = y:Clone()
local b = Instance.new("BodyVelocity")
b.Velocity = game.Workspace.BilaX.CFrame.lookVector * 1
b.Parent = cly
cly.Parent = game.Workspace
cly.CFrame = game.Workspace.BilaX.CFrame * CFrame.new(0, 0, 0)
cl:Destroy()
wait(2)
cly:Destroy()
end
game.Debris:AddItem(cl, 4)
shot = 1
end
end
end)
print ("merge fireball")
