-
What do you want to achieve? I’m making a script that does damage to players if they touch the blade of my knife
-
What is the issue? Won’t work for some reason, no errors, I believe it has something to do with my debounce but I don’t know what?
-
What solutions have you tried so far? Every solution basically lol
Main Local Script:
local Knife = script.Parent.Parent
local Blade = Knife.Blade
local Handle = Knife.Handle
local SlashAnim = Knife.Animations.Slash
local EquipSound = Handle.Equip
local HitSound = Handle.Hit
local SlashSound = Handle.Slash
local UnEquipSound = Handle.UnEquip
local CanDamage = script.Parent.Parent.Values.CanDamage.Value
local Cooldown = Knife.Values.Cooldown.Value
local CooldownWait = 1
Knife.Equipped:Connect(function()
EquipSound:Play()
end)
Knife.Unequipped:Connect(function()
UnEquipSound:Play()
end)
Knife.Activated:Connect(function()
local Humanoid = Knife.Parent:FindFirstChildWhichIsA('Humanoid')
if Humanoid and Cooldown == false then
Cooldown = true
CanDamage = true
local PlaySlashAnim = Humanoid:LoadAnimation(SlashAnim)
PlaySlashAnim:Play()
wait(0.3)
SlashSound:Play()
wait(CooldownWait)
Cooldown = false
CanDamage = false
end
end)
Server-Kill Script
local CanDamage = script.Parent.Parent.Values.CanDamage.Value
local Damage = script.Parent.Parent.Values.Damage.Value
local Blade = script.Parent.Parent.Blade
Blade.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and CanDamage == true then
hit.Parent:TakeDamage(Damage)
CanDamage = false
end
end)
Both scripts are in a folder named (Scripts)