You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want the Zombie Giant to take 1 extra hit everytime he gets downed but he takes 1 less instead. When I keep a static number and I dont change the Hits value it still goes less.
-
What is the issue? I don’t know what the problem is and i don’t know how to fix it
-
What solutions have you tried so far? I tried making the Hits value less and it still was not working.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
ReplicatedStorage = game:GetService("ReplicatedStorage")
TweenService = game:GetService("TweenService")
Lighting = game:GetService("Lighting")
ZombieGiant = script.Parent
Humanoid = ZombieGiant:FindFirstChild("Humanoid")
CamEvent = game:GetService("ReplicatedStorage"):WaitForChild("Explosion")
ServerSfx = workspace:WaitForChild("ServerSounds")
local CanDamage = true
local CanDamage2 = false
local HealthTillRage = 11000
local Hits = 0
local WantedHits = 5
local Rage = false
local CanAttack = true
local humanoidCanGetHealthChanged = true
local c = false
ZombieGiant.HumanoidRootPart:SetNetworkOwner(nil)
--Animations
local Animations = ZombieGiant:WaitForChild("Animations")
Walk = Humanoid:LoadAnimation(Animations.Walk)
Cover = Humanoid:LoadAnimation(Animations.Cover)
Fall = Humanoid:LoadAnimation(Animations.Fall)
Idle = Humanoid:LoadAnimation(Animations.Idle)
Run = Humanoid:LoadAnimation(Animations.Run)
Swipe = Humanoid:LoadAnimation(Animations.Swipe)
Walk:Play()
Walk:AdjustSpeed(.45)
local ResetDifference = false
local Health = {};
local function DetectHealth(Humanoid)
if (not Health[Humanoid]) then
Health[Humanoid] = Humanoid.Health
end
local Difference = (Health[Humanoid] - Humanoid.Health);
Health[Humanoid] = Humanoid.Health
return Difference
end
local Health2 = {};
local Difference = 0
local function DetectHealth2(Humanoid)
if (not Health2[Humanoid]) then
Health2[Humanoid] = Humanoid.Health
end
if ResetDifference == false then
Difference = (Health2[Humanoid] - Humanoid.Health);
Health2[Humanoid] = Humanoid.Health
return Difference
elseif ResetDifference == true then
Difference = 0
end
end
if humanoidCanGetHealthChanged == true then
Humanoid.HealthChanged:Connect(function(health)
if humanoidCanGetHealthChanged == true then
local healthLost = DetectHealth(Humanoid)
local Death; Death = Humanoid.Died:Connect(function()
Death:Disconnect()
Health[Humanoid] = nil
end)
local DamageIndicator = ReplicatedStorage:FindFirstChild("GUIs").HealthIndicator:Clone()
DamageIndicator.Parent = ZombieGiant.Head
DamageIndicator.Adornee = ZombieGiant.Head
DamageIndicator.DamageLabel.Text = healthLost
DamageIndicator.Enabled = true
local offsetX = math.random(-15, 8)
local offsetY = math.random(0, 4)
local offsetZ = math.random(-15, 8)
local DITween = TweenService:Create(DamageIndicator, TweenInfo.new(.4, Enum.EasingStyle.Linear), {StudsOffset = Vector3.new(offsetX, offsetY, 0), Size = UDim2.new(0,0,0,0)})
local DITTween = TweenService:Create(DamageIndicator.DamageLabel, TweenInfo.new(.4, Enum.EasingStyle.Sine), {TextTransparency = 1})
DITween:Play()
DITTween:Play()
local hRootPart = ZombieGiant.HumanoidRootPart
local lookVector = hRootPart.CFrame.LookVector
--[[local KnockbackTween = TweenService:Create(lookVector, TweenInfo.new(.25), {lookVector.X + AddX, lookVector.Y + AddY, lookVector.Z + AddZ})
KnockbackTween:Play()--]]
HealthTillRage -= healthLost
if HealthTillRage <= 0 and Rage == false then
initiateRage()
elseif HealthTillRage <= 7000 then
local chance = math.random(1, 11)
if chance == 11 and CanDamage == true then
cover()
end
end
DITween.Completed:Connect(function()
DamageIndicator:Remove()
end)
--end
end
end)
end
function cover()
Cover:Play()
task.wait(2)
Cover:Stop()
end
local function checkDamage()
if Hits >= WantedHits then
c = false
--WantedHits = math.clamp(WantedHits + 1, 1, 5)
WantedHits = 5
CanAttack = false
Humanoid.WalkSpeed = 0
Run:Stop()
Fall:Play()
ZombieGiant.Head.Screaming.Playing = false
ZombieGiant.Head.Fallen:Play()
task.wait(2.5)
CanAttack = true
Fall:Stop()
Walk:Play()
Walk:AdjustSpeed(.45)
Humanoid.WalkSpeed = 11
HealthTillRage = 11000
Rage = false
CanDamage2 = false
CanDamage = true
humanoidCanGetHealthChanged = true
Hits =- 1
end
end
function initiateRage()
CanAttack = false
Rage = true
HealthTillRage = 999999
humanoidCanGetHealthChanged = false
Walk:Stop()
Fall:Play()
Humanoid.WalkSpeed = 0
ZombieGiant.Head.Fallen:Play()
task.wait(math.random(2.7, 3.2))
Fall:Stop()
Idle:Play()
task.wait(math.random(2.2, 2.6))
Idle:Stop()
Walk:Play()
Walk:AdjustSpeed(1.3)
Humanoid.WalkSpeed = 46
CanDamage2 = true
ZombieGiant.Head.Screaming.Playing = true
Hits = 0
CanAttack = true
c = true
if c == true then
Humanoid.HealthChanged:Connect(function(health)
if CanDamage2 == true then
Hits += 1
task.wait(.001)
checkDamage()
end
end)
end
end
------ ^^^ RAGE MODE ^^^ ------
local function scratch(plr)
if CanAttack == true then
Swipe:Play()
task.wait(.3)
plr.Character.Humanoid.Health -= 600
ZombieGiant.Head.Attack:Play()
end
end
local function scratchAttack(Player)
for _, player in ipairs(workspace:GetChildren()) do
if player:IsA("Model") and player:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(player)
if plr then
task.wait(.1)
local magnitude = (ZombieGiant.Torso.Position - plr.Character.Torso.Position).magnitude
if magnitude <= 29 then
local db = false
if db == false then
db = true
scratch(plr)
task.wait(1)
db = false
end
end
end
end
end
end
spawn(function()
while true do
task.wait(1)
scratchAttack()
end
end)
You use guns to damage the boss, you are suppose to be able to shoot it 5 times at the start and +1 shot every time to down him again but it doesn’t work