thanks but theres still a problem, i want to make the player stop losing dodges if hes currently dodging, because of the health:healthchange function, is there any other way?
Dodges says 0 on the gui, assuming you have more than 1:
Instead of damaging the player, you should create a module script that damages the player. The module script go through checks, in the specific check it checks if the player has any dodges left.
If there is then it removes a dodge. Else it damages the player.
For the killbrick, i assume you use touched event, touched event is a bit laggy and bad so id prefer if you would have a Debounce for it that lastes like a second or 2
local function PlayerTouched(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) and not cooldown then
cooldown = true
Parent.Humanoid.Health = 0
wait()
cooldown = false
end
end
Brick.Touched:connect(PlayerTouched)
including some changes to the dodge script
local humanoid = script.Parent.Humanoid
local dodges = script.Dodges
local cooldown = false
local dodge = script.Dodge
local animater = humanoid:LoadAnimation(dodge)
humanoid.HealthChanged:Connect(function()
if dodges.Value == 0 and not cooldown then
return
elseif not cooldown and dodges.Value > 0 then
local forcefield = Instance.new("ForceField")
cooldown = true
forcefield.Visible = false
forcefield.Parent = script.Parent.HumanoidRootPart
humanoid.Health = humanoid.MaxHealth
animater:Play()
dodges.Value = dodges.Value - 1
print("Dodged")
task.wait(1)
forcefield:Destroy()
cooldown = false
end
end)
but it only made it worse, now instently killing me when ever i touch the kill brick