I am making one tool and the part (spray) when hits the character doesnt happen only 1 time (basicly makes a lot of damage)
You can see on the script only makes 35 damage on head and 20 if hit other part but on the gif is like hit kill.
Gif:
local debounce = false
local spray = script.Parent
local sound = spray.HitSound
sound.TimePosition = 4
local sound2 = spray.FloorHit
local function player_check(otherPart)
if not otherPart.Parent:FindFirstChild("Humanoid") then return end
local Attacker = spray:FindFirstChild("Attacker")
if Attacker then
local humanoid = otherPart.Parent.Humanoid
local character = humanoid.Parent
local humanoidRoot = character.HumanoidRootPart
if humanoid.Parent.Name ~= spray.Attacker.Value then
if otherPart.Name == "Head" then
sound:Play()
sound2:Play()
humanoid:TakeDamage(35)
else
sound:Play()
sound2:Play()
humanoid:TakeDamage(20)
end
end
debounce = false
end
end
spray.Touched:Connect(player_check)
game.Debris:AddItem(spray, 2.5)
local debounce = false
local spray = script.Parent
local sound = spray.HitSound
sound.TimePosition = 4
local sound2 = spray.FloorHit
local function player_check(otherPart)
if not debounce then
debounce = true
sound:Play()
sound2:Play()
if not otherPart.Parent:FindFirstChild("Humanoid") then return end
local Attacker = spray:FindFirstChild("Attacker")
if Attacker then
local humanoid = otherPart.Parent.Humanoid
local character = humanoid.Parent
local humanoidRoot = character.HumanoidRootPart
if humanoid.Parent.Name ~= spray.Attacker.Value then
if otherPart.Name == "Head" then
humanoid:TakeDamage(35)
else
humanoid:TakeDamage(20)
end
debounce = false
end
end
end
end
spray.Touched:Connect(player_check)
game.Debris:AddItem(spray, 2.5)