I am revamping a SFOTH sword, which Is the GhostWalker but what I like to call It: "Ghost Eye" The ability Is to make you completely Invisible when taking damage, but after 5 seconds or when the tool has been equip It makes you slightly Invisible, the tool works but I realized that when taking damage or healing It still fires the ability
Script:
local Tool = script.Parent
local SoundFolder = Tool.Sounds
local SlashAttack
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
Humanoid.WalkSpeed = 20
Tool.Handle.Transparency = 0.9
Humanoid.Parent.Head.Transparency = 0.9
Humanoid.Parent.Torso.Transparency = 0.9
Humanoid.Parent["Left Arm"].Transparency = 0.9
Humanoid.Parent["Right Arm"].Transparency = 0.9
Humanoid.Parent["Left Leg"].Transparency = 0.9
Humanoid.Parent["Right Leg"].Transparency = 0.9
local EquipAnimationTrack = Humanoid:FindFirstChild("Animator"):LoadAnimation(Animations.EquipAnimation)
EquipAnimationTrack:Play()
task.wait(0.30)
local Idle = Humanoid:FindFirstChild("Animator"):LoadAnimation(Animations.Idle)
Idle:Play()
Humanoid.HealthChange:Connect(function()
Humanoid.WalkSpeed = 30
Tool.Handle.Transparency = 1
Humanoid.Parent.Head.Transparency = 1
Humanoid.Parent.Torso.Transparency = 1
Humanoid.Parent["Left Arm"].Transparency = 1
Humanoid.Parent["Right Arm"].Transparency = 1
Humanoid.Parent["Left Leg"].Transparency = 1
Humanoid.Parent["Right Leg"].Transparency = 1
wait(5)Humanoid.WalkSpeed = 20
Tool.Handle.Transparency = 0.9
Humanoid.Parent.Head.Transparency = 0.9
Humanoid.Parent.Torso.Transparency = 0.9
Humanoid.Parent["Left Arm"].Transparency = 0.9
Humanoid.Parent["Right Arm"].Transparency = 0.9
Humanoid.Parent["Left Leg"].Transparency = 0.9
Humanoid.Parent["Right Leg"].Transparency = 0.9
end)
Tool.Unequipped:Connect(function()
Humanoid.WalkSpeed = 16
Tool.Handle.Transparency = 0.5
Humanoid.Parent.Head.Transparency = 0
Humanoid.Parent.Torso.Transparency = 0
Humanoid.Parent["Left Arm"].Transparency = 0
Humanoid.Parent["Right Arm"].Transparency = 0
Humanoid.Parent["Left Leg"].Transparency = 0
Humanoid.Parent["Right Leg"].Transparency = 0
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()
wait(1)
Boolens.Debounce = false
Boolens.CanDamage = 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(10)
humanoid.WalkSpeed = 10
humanoid.JumpPower = 30
wait(5)
humanoid.WalkSpeed = 16
humanoid.JumpPower = 50
end
end
end
else
local NPCHumanoid = hit.Parent:WaitForChild("Humanoid")
if NPCHumanoid and Boolens.CanDamage == true then
Boolens.CanDamage = false
NPCHumanoid:TakeDamage(10)
NPCHumanoid.WalkSpeed = 10
NPCHumanoid.JumpPower = 30
wait(5)
NPCHumanoid.WalkSpeed = 16
NPCHumanoid.JumpPower = 50
end
end
end)
--[[Facts:
Originally made you Invisible when damaged, even the original tooltip tells you this:
A ghost with algophobia formed Into a sword, thats why It makes you Invisible when being damaged
]]
