I’m trying to make a knife throw script and it works fine, the trajectory of the projectile is completely straight anywhere you look at, but the problem is the projectile. It’s not facing the right way when it’s thrown, not the trajectory but the projectile itself. Images for context:
Script is down here:
local rp = game:GetService(“ReplicatedStorage”)
local KnifeThrow = rp:WaitForChild(“TheWorldRemotes”):WaitForChild(“KnifeThrow”)local debris = game:GetService(“Debris”)
KnifeThrow.OnServerEvent:Connect(function(player)
local character = player.Character
local humanoid = character:WaitForChild(“Humanoid”)
local humanoidrp = character:WaitForChild(“HumanoidRootPart”)local Stand = workspace:FindFirstChild(player.Name…" Stand"):FindFirstChild(“The World”)
local Folder = Instance.new(“Folder”, workspace)
Folder.Name = player.Name…" Knife Throw"
debris:AddItem(Folder,.5)if Stand then
local prevWeld = Stand:WaitForChild(“HumanoidRootPart”):WaitForChild(“Stand Weld”)
prevWeld:Destroy()Stand:WaitForChild("HumanoidRootPart").CFrame = humanoidrp.CFrame * CFrame.new(0,0,-2.5) local weld = Instance.new("ManualWeld") --creates a new weld to move our stand forward weld.Name = "Stand Weld" weld.Part0 = Stand:WaitForChild("HumanoidRootPart") weld.Part1 = humanoidrp weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * humanoidrp.CFrame weld.Parent = weld.Part0 local AnimControl = Stand:WaitForChild("AnimControl")
for i, track in pairs(AnimControl:GetPlayingAnimationTracks()) do --stops previous animations
track:Stop()local Throw = AnimControl:LoadAnimation(script:WaitForChild("Throw")) Throw:Play() --plays the animation local throwwhiff = Instance.new("Sound") throwwhiff.SoundId = "rbxassetid://536642316" throwwhiff.Volume = 1 throwwhiff.Parent = Stand throwwhiff:Play() debris:AddItem(throwwhiff,2) local knifethrown = script.knifethrown:Clone() knifethrown.CFrame = Stand:WaitForChild("Right Arm").CFrame + Vector3.new(0,-1,0) knifethrown.Orientation = character:WaitForChild("Torso").CFrame.LookVector knifethrown.Parent = workspace debris:AddItem(knifethrown,15) local TimeStopped = player.Backpack:FindFirstChild("The World"):WaitForChild("TimeStopped") if TimeStopped.Value == true then knifethrown.Anchored = true end local vel = Instance.new("BodyVelocity",knifethrown) vel.MaxForce = Vector3.new(math.huge,math.huge,math.huge) vel.Velocity = character:WaitForChild("Torso").CFrame.LookVector * 65 knifethrown.Touched:Connect(function(hit) if hit:IsA("Part") or hit:IsA("MeshPart") then local EHumanoid = hit.Parent:FindFirstChild("Humanoid") if EHumanoid then knifethrown:Destroy() EHumanoid:TakeDamage(11) local blood = Instance.new("ParticleEmitter") blood.Parent = hit blood.Texture = "rbxassetid://116830967" blood.LightEmission = .125 blood.LightInfluence = 1 blood.Transparency = NumberSequence.new(.5,1) blood.Lifetime = NumberRange.new(.3,.5) blood.Rotation = NumberRange.new(45) blood.RotSpeed = NumberRange.new(90) blood.Speed = NumberRange.new(0) blood.Size = NumberSequence.new(.95,1.25) blood.Acceleration = Vector3.new(0,-5,0) debris:AddItem(blood,10) local throwhitting = Instance.new("Sound") throwhitting.Volume = 1 throwhitting.SoundId = "rbxassetid://186311262" throwhitting.Parent = workspace throwhitting:Play() debris:AddItem(throwhitting,16) end end end) wait(1) local prevWeld = Stand:WaitForChild("HumanoidRootPart"):WaitForChild("Stand Weld") prevWeld:Destroy() Stand:WaitForChild("HumanoidRootPart").CFrame = humanoidrp.CFrame * CFrame.new(2,0,2) local weld = Instance.new("ManualWeld") weld.Name = "Stand Weld" weld.Part0 = Stand:WaitForChild("HumanoidRootPart") weld.Part1 = humanoidrp weld.C0 = Stand:WaitForChild("HumanoidRootPart").CFrame:inverse() * humanoidrp.CFrame weld.Parent = weld.Part0 local idle = AnimControl:LoadAnimation(script:WaitForChild("Idle")) idle:Play()
wait(7)
knifethrown.Anchored = falseend
KnifeThrow:FireClient(player)
end
end)
if you know what’s causing this issue, please help.