Issue
For my throwing knife, it has gravity added to it. (When thrown, it falls down)
I’m not sure how I can fix this issue, and disable the gravity. Something like MM2 knives.
I have fixed the original script for the Roblox throwing knife model. But, you can’t really change the properties of gravity added to it.
Contact
If there is a way to fix this, let me know by replying or messaging me.
I also want a way to fix the issue with knives getting stuck in mid-air when thrown at other players. Sometimes the knives don’t even get to hit the player because of other knives blocking the way.
use bodyvelocity if you dont want the knives getting affected by gravity and use bodyforce if you want the knives to fall by gravity
and make the knife can collide off if you want the knife to go through other knofes and not hit
local knife = script.Parent
local handle = knife:WaitForChild("Handle")
local throwRE = knife:WaitForChild("ThrowKnife")
local throwAnim = script:WaitForChild("ThrowAnimation")
local cooldown = 0.1
local isCooldown = false
throwRE.OnServerEvent:Connect(function(plr, mouseHit)
local character = plr.Character
if not character or not character:FindFirstChild("Humanoid") then return end
if isCooldown then return end
isCooldown = true
character.Humanoid:LoadAnimation(throwAnim):Play()
wait(0.4)
local knifeClone = handle:Clone()
knifeClone.Velocity = mouseHit.LookVector * 200
knifeClone.Parent = workspace
handle.Transparency = 1
knifeClone.Throw:Play()
knifeClone.CFrame = CFrame.new(knifeClone.Position, mouseHit.LookVector * 200)
local bav = Instance.new("BodyAngularVelocity")
bav.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
bav.AngularVelocity = knifeClone.CFrame:VectorToWorldSpace(Vector3.new(-400, 0, 0))
bav.Parent = knifeClone
game.ReplicatedStorage.ClientKnife:FireAllClients(knifeClone, knife.Parent)
knifeClone.Touched:Connect(function(touched)
if touched.Transparency < 1 and not knife.Parent:IsAncestorOf(touched) then
local humanoid = touched.Parent:FindFirstChild("Humanoid") or touched.Parent.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid.Health = 0
end
knifeClone.Anchored = true
knifeClone.Hit:Play()
wait(knifeClone.Hit.TimeLength)
knifeClone:Destroy()
end
end)
wait(cooldown - 0.4)
isCooldown = false
handle.Transparency = 0
end)
What in the script do I change to remove the gravity?
local knife = script.Parent
local handle = knife:WaitForChild("Handle")
local throwRE = knife:WaitForChild("ThrowKnife")
local throwAnim = script:WaitForChild("ThrowAnimation")
local cooldown = 0.1
local isCooldown = false
throwRE.OnServerEvent:Connect(function(plr, mouseHit)
local character = plr.Character
if not character or not character:FindFirstChild("Humanoid") then return end
if isCooldown then return end
isCooldown = true
character.Humanoid:LoadAnimation(throwAnim):Play()
wait(0.4)
local knifeClone = handle:Clone()
knifeClone.Velocity = mouseHit.LookVector * 200
knifeClone.CanCollide = false
knifeClone.Massless = true
knifeClone.Parent = workspace
handle.Transparency = 1
knifeClone.Throw:Play()
knifeClone.CFrame = CFrame.new(knifeClone.Position, mouseHit.LookVector * 200)
local bav = Instance.new("BodyAngularVelocity")
bav.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
bav.AngularVelocity = knifeClone.CFrame:VectorToWorldSpace(Vector3.new(-400, 0, 0))
bav.Parent = knifeClone
game.ReplicatedStorage.ClientKnife:FireAllClients(knifeClone, knife.Parent)
knifeClone.Touched:Connect(function(touched)
if touched.Transparency < 1 and not knife.Parent:IsAncestorOf(touched) then
local humanoid = touched.Parent:FindFirstChild("Humanoid") or touched.Parent.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid.Health = 0
end
knifeClone.Anchored = true
knifeClone.Hit:Play()
wait(knifeClone.Hit.TimeLength)
knifeClone:Destroy()
end
end)
wait(cooldown - 0.4)
isCooldown = false
handle.Transparency = 0
end)
1 Like