So, I am making a fireball script when a player press F and it works except for the rotation of the fireball, i want the rotation to be facing the same way the player is facing and I don't know what I did wrong here.
Script:
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
CanShoot = true
In = false
repeat wait() until plr.Character
local char = plr.Character
mouse.KeyDown:connect(function(key)
if key == "f" then
if CanShoot == true and In == false then
In = true
CanShoot = false
local part = Instance.new("Part")
local fire = Instance.new("Fire",part)
local Mesh = Instance.new("SpecialMesh",part)
fire.Size = 3.4
Mesh.MeshId = "rbxassetid://475201433"
Mesh.Scale = Vector3.new(0.1,0.1,0.1)
Mesh.TextureId = "rbxassetid://475201512"
part.Parent = workspace
part.Name = 'FireBall'
part.CanCollide = false
part.Anchored = true
part.Position = plr.Character.Torso.Position
local move = Instance.new("BodyVelocity", part)
move.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
move.Velocity = plr.Character.Torso.CFrame.lookVector*100
wait(3)
part:Destroy()
CanShoot = true
In = false
end
end
end)
The Problem Is At Line 26 And I Don't Know What I Did Wrong Here.

1 comment
Please don't use mouse.KeyDown. It is deprectaed. You should use ContextActionService or UserInputService. Plus, connect is depricated, use Connect. Plus, if you remove the second argument of Instance.new, then do the properties, after that, do [instacnename].Parent = [instanceparent]