I made my own throwing knife. Right now, the knife hits the player that threw it and hurts them instead of hurting the target. When it does hit the target, the target doesn't take damage but I am assuming that is because of the debounce. Here is my code
local playerthrownid = script.Parent:GetAttribute("PlayerThrownId")
local debounce = false
script.Parent.Touched:Connect(function(hit)
local Character = hit:FindFirstAncestorOfClass("Model")
if Character and Character:FindFirstChild("Humanoid") then
local Player = game.Players:GetPlayerFromCharacter(Character)
local HitPlayerID = Player.UserId
print(HitPlayerID)
print(playerthrownid)
if HitPlayerID ~= playerthrownid then
if debounce == false then
debounce = true
local plr = hit.Parent
local player = game.Players:GetPlayerFromCharacter(plr)
local id = player.UserId
game.ReplicatedStorage.ThrownKnifeHitSound:FireClient(player, id)
Character.Humanoid.Health -= 35
end
end
end
end)