Hello!
I'm trying to get a sword that when you get a kill, a kill will be Inserted In the Kills IntValue, however, It does not add a kill, also when you reach a phase, like this example:
5 kills = Phase 1
Its suppose to speed up the player as well of playing a theme, just Its not adding the phase, It also appears to not show a error message In output
Script:
local Tool = script.Parent
local SoundFolder = Tool.Sounds
local SlashAttack
local KillsValue = Tool.Kills
local Boolens = {
Debounce = false,
CanDamage = false
}
local Animations = {
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)
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(30)
if humanoid.Health == 0 then
SoundFolder["Kill Get"]:Play()
KillsValue.Value = KillsValue.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(30)
if NPCHumanoid.Health == 0 then
SoundFolder["Kill Get"]:Play()
KillsValue.Value = KillsValue.Value + 1
end
end
end
end)

8 comments
Small note: instead of KillsValue.Value = KillsValue.Value + 1 he/she can just do KillsValue += 1
Yea
Its giving kills, just not adding the phases, also there Is a script Inside a IntValue
Wdym not in the phases
Basically when you reach lets say 5 kills, you get a speed boost
Oh sorry edited
Thanks!
Np