hey so i made a knife, but for some reason it’s glitching my game. when i was testing it, it would duplicate a players tools after they were killed with it, and on the 5th or 4th test, the player wouldnt respawn after dying. the script and animation was made by me. the mesh wasn’t made by me. although i grabbed the mesh from the “Meshes” category in the toolbox so im assuming its harmless
heres the script
local tool = script.Parent
local cooldown = 2
local attackCooldown = false
local isCooldown = false
local player = script:FindFirstAncestorWhichIsA"Player" or game:GetService"Players":GetPlayerFromCharacter(script.Parent.Parent)
tool.Activated:Connect(function()
local humanoid = script.Parent.Parent:WaitForChild("Humanoid")
local animation = script.Parent:WaitForChild("Animation")
local anim = script.Parent.Parent.Humanoid:LoadAnimation(animation)
if not isCooldown then
anim:Play()
isCooldown = true
humanoid.WalkSpeed = 5
player.Character.Sprint.Disabled = true
wait(cooldown)
player.Character.Sprint.Disabled = false
humanoid.WalkSpeed = 16
isCooldown = false
end
script.Parent.Handle.Touched:Connect(function(touched)
if touched.Name == "Head" and isCooldown then
if not attackCooldown then
attackCooldown = true
touched.Parent.Humanoid.Health -= 30
wait(cooldown)
attackCooldown = false
end
end
end)
end)
feel free to ask any questions