Im making a sword where each time you get a kill, a IntValue changes by 1, which for example the IntValues value Is 3 (Which equals to 3 kills) you get a small boost, but It appears to do nothing
Script:
local Tool = script.Parent
local SoundFolder = Tool.Sounds
local SlashAttack
local DamagePerSlash = 20
local Boolens = {
Debounce = false,
CanDamage = false
}
local Animations = { ---Oh boi there Is alot
EquipAnimation = Tool.EquipAnimation,
Idle = Tool.Idle,
Slash = Tool.Slash,
}
Tool.Equipped:Connect(function()
SoundFolder.Unsheath:Play()
local Humanoid = Tool.Parent.Humanoid
local EquipAnimationTrack = Humanoid:FindFirstChild("Animator"):LoadAnimation(Animations.EquipAnimation)
EquipAnimationTrack:Play()
task.wait(0.30)
local Idle = Humanoid:FindFirstChild("Animator"):LoadAnimation(Animations.Idle)
Idle:Play()
Tool.Unequipped:Connect(function()
Idle:Stop()
end)
end)
---Phases---
if Tool.Kills.Value == 3 then
DamagePerSlash = 25
end
if Tool.Kills.Value == 5 then
DamagePerSlash = 30
Tool.Parent.Humanoid.WalkSpeed = 20
local ThemeSong = Instance.new("Sound")
ThemeSong.Parent = Tool.Parent.Torso
ThemeSong.Name = "ThemeSong"
ThemeSong.Volume = 3
ThemeSong.Looped = true
ThemeSong.SoundId = "rbxassetid://10033782180"
ThemeSong:Play()
end
if Tool.Kills.Value == 15 then
DamagePerSlash = 35
Tool.Parent.Humanoid.WalkSpeed = 30
local ThemeSong = Instance.new("Sound")
ThemeSong.Parent = Tool.Parent.Torso
ThemeSong.Name = "ThemeSong"
if Tool.Parent.Torso:FindFirstChild("ThemeSong") then
ThemeSong.Volume = 3
ThemeSong.Looped = true
ThemeSong.SoundId = "rbxassetid://10239133106"
ThemeSong:Play()
end
end
Tool.Activated:Connect(function()
if not Boolens.Debounce then
Boolens.Debounce = true
Boolens.CanDamage = true
SoundFolder.Slash:Play()
print("The tool has been clicked")
local Humanoid = Tool.Parent.Humanoid
SlashAttack = Humanoid:FindFirstChild("Animator"):LoadAnimation(Animations.Slash)
SlashAttack:Play()
task.wait(0.5)
Boolens.CanDamage = false
wait(1)
Boolens.Debounce = false
end
end)
Tool.Handle.Touched:Connect(function(hit)
local Player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if Player then
local player1 = game.Players:GetPlayerFromCharacter(Tool.Parent)
local player2 = game.Players:GetPlayerFromCharacter(hit.Parent)
if (player1 ~= nil) and (player2 ~= nil) then
local humanoid = (player2.Character or player2.CharacterAdded:Wait()):FindFirstChildWhichIsA("Humanoid")
if (player1.TeamColor ~= player2.TeamColor) then
if (humanoid ~= nil) and Boolens.CanDamage == true then
Boolens.CanDamage = false
humanoid:TakeDamage(DamagePerSlash)
if humanoid.Health == 0 then
SoundFolder["Kill Get"]:Play()
Tool.Kills.Value = Tool.Kills.Value + 1
end
end
end
end
else
local NPCHumanoid = hit.Parent:WaitForChild("Humanoid")
if NPCHumanoid and Boolens.CanDamage == true then
Boolens.CanDamage = false
NPCHumanoid:TakeDamage(DamagePerSlash)
if NPCHumanoid.Health == 0 then
SoundFolder["Kill Get"]:Play()
Tool.Kills.Value = Tool.Kills.Value + 1
end
end
end
end)

2 comments
what does the error say?
i dont see any force or bodyMovers to push the player