I am trying to make one kill effect but it works only 1 time.
GIF:
Normal script (Is not local):
local tool = script.Parent
local CanAttack = true
local hitCharacters = {}
local debounce = false
local hitSound = tool:WaitForChild("HitSound")
local killThing = game.ReplicatedStorage.TestKill
local LocalPlayer = game:GetService("Players").LocalPlayer
tool.Activated:Connect(function()
local humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
if not debounce then
debounce = true
tool.Blade.Touched:Connect(function(touch)
if hitCharacters[touch.Parent] or not debounce then return end
if touch.Parent:FindFirstChild("Humanoid") then
if touch.Name == "Head" then
touch.Parent.Humanoid:TakeDamage(30)
hitSound:Play()
elseif touch.Name == "HumanoidRootPart" then
touch.Parent.Humanoid:TakeDamage(50)
hitSound:Play()
else
touch.Parent.Humanoid:TakeDamage(25)
hitSound:Play()
end
hitCharacters[touch.Parent] = true
wait(0.5)
hitCharacters[touch.Parent] = nil
debounce = false
end
end)
end
end)
--------------------------- here the kill effect function------------------------------
tool.Blade.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health <= 0 then
local character = hit.Parent
local humanoid = character.Humanoid
local humanoidRootPart = character.HumanoidRootPart
print("test")
killThing:Clone()--------------------------------
killThing.Parent = humanoidRootPart--------------Issue
killThing.Position = humanoidRootPart.Position---
end
end)
----------------------------------------------------------------------------------------
Any Idea what is wrong?
If you find the issue please replie