What I want to achieve: I want the projectiles to spawn behind an npc and go towards another player
The issue: When I’m on the Z axis its perfectly fine but when I’m on the X axis it spawns only on the z axis
What I’ve tried: I’ve tried to change the CFrame by using CFrame.new(0, 0, 5) but it still spawns sideways
heres a snippet of my code (sorry if its not enough its my first time posting here)
local function knives(Position)
local plr = script.Parent
if CD == true then
CD = false
for i = 1,math.random(7,30) do
local random = math.random(-20,20)
local Attack = Instance.new("Part")
Attack.Transparency = 1
local ok = script.Mesh:Clone()
ok.Parent = Attack
Attack.Size = Vector3.new(0.142, 0.493, 2.506)
Attack.Anchored = true
Attack.Color = Color3.fromRGB(255,0,0)
Attack.Material = Enum.Material.Glass
Attack.CanCollide = false
Attack.CanQuery = false
Attack.Name = "knife"
local Attack2 = script.knife:Clone()
Attack.Parent = Attack2
local ov = Instance.new("ObjectValue")
ov.Value = script.Parent
ov.Parent = Attack
ov.Name = "creator"
Attack.CFrame *= CFrame.new(0,0,5)
Attack2.stuff.Script:Clone().Parent = Attack
Attack2.stuff.move:Clone().Parent = Attack
Attack2.stuff.Sound:Clone().Parent = Attack
Attack2.stuff.summon:Clone().Parent = Attack
Attack2.knife.Script.Enabled = true
Attack2.knife.move.Enabled = true
Attack2.Parent = workspace
Attack2.knife.CFrame = CFrame.lookAt(Attack2.knife.Position, Position)
Attack2.PrimaryPart = Attack
Attack2:SetPrimaryPartCFrame(CFrame.new(script.Parent.Head.Position + Vector3.new(random,1,0), Position))
end
spawn(function()
task.wait(15)
CD = true
end)
end
end