Hello i am making a projectile and everytime i fire the projectile it ends up facing my character instead of the way it's travelling.Here is the script below.
local Player = game.Players.LocalPlayer
repeat wait() until Player.Character~= nil
Character = Player.Character
Mouse = Player:GetMouse()
Enabled = true
ButtonDown = true
local particle =Instance.new("ParticleEmitter")
Mouse.KeyDown:connect(function(key)
if Enabled == false then return end
key = key:lower()
if key == "q" then
Enabled = false
MegentaHirizon = Instance.new("Part")
local MegentaHirizon = game.ReplicatedStorage["MegentaHirizon"]:Clone()
MegentaHirizon.Parent = Character
MegentaHirizon.Anchored = true
MegentaHirizon.CFrame = Character.UpperTorso.CFrame * CFrame.new(0,0,-5)
Dval = Instance.new ("IntValue", Player)
---Forces------------------------------------------------------
BG = Instance.new("BodyGyro", Character.UpperTorso)
BG.Name = "SkillGyro"
BG.D = 100
BG.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
BP = Instance.new("BodyPosition", Character.UpperTorso)
BP.Position = Player.Character.HumanoidRootPart.Position
BP.maxForce = Vector3.new(math.huge, math.huge, math.huge)
-----------------------------------------------------------------
Charge = 0
---
while ButtonDown == true do
local Pos = Mouse.Hit.p
Charge = Charge + 1
# #G######### CFrame.new(Player.Character.UpperTorso.Position, Pos)
wait()
if Charge == 250 then break end
end
---
MegentaHirizon.CFrame = Character.UpperTorso.CFrame*CFrame.new(0,5,0)
MegentaHirizon.Anchored = false
MegentaHirizon.CanCollide = false
BV = Instance.new("BodyVelocity")
BV.maxForce = Vector3.new(math.huge,math.huge,math.huge)
BV.velocity = Character.UpperTorso.CFrame.lookVector*100
BV.Parent = MegentaHirizon
Dmg = script.Damage:Clone()
Dmg.DmgVal.Value = Dval.Value
Dmg.Parent = MegentaHirizon
Dmg.Disabled = false
ButtonDown = true
BG:remove()
BP:remove()
Dval = 0
wait(5)
Enabled = true
end
end)
Mouse.KeyUp:connect(function(key)
key = key:lower()
if key == "q" then
ButtonDown = false
Enabled = true
end
end)
|