end
CarryingKid = enemy
enemy.Humanoid.PlatformStand = true
Weld.Parent = Char.Torso
Weld.Part0 = enemy.HumanoidRootPart
Weld.C0 = CFrame.new(0,-1.5,-1.15)
--anim2 = enemy.Humanoid:LoadAnimation(script.Anims.Carried)
Root.Anchored = false
enemy.HumanoidRootPart.Velocity = Vector3.new(0,0,0)
Root.Velocity = Vector3.new(0,0,0)
--anim:Play()
--anim2:Play()
CarryingKid = enemy
repeat
wait()
print("Waiting for condition to be met")
until enemy.Humanoid.Health <= 100
Drop(enemy:WaitForChild("HumanoidRootPart").CFrame)
Char:FindFirstChild("Carrying"):Destroy()
GOTSOMEONE = false
end
end
end
end
--else
-- Drop(Root.CFrame)
end
end)
repeat
wait()
print(âWaiting for condition to be metâ)
until enemy.Humanoid.Health <= 100
Drop(enemy:WaitForChild(âHumanoidRootPartâ).CFrame)
Char:FindFirstChild(âCarryingâ):Destroy()
GOTSOMEONE = false
I made a carrying system where you can carry other players while there knocked. I been having a problem I want when the player being carried has full health then the player carrying the person automatically drops him. The dropping part of the script works ,but Iâm having a problem of finding a way to check when the enemy player has full health.
You could use .Changed or :GetPropertyChangedSignal(âHealthâ) and then call the function every time itâs changed? Itâs also wiser to use as youâre able to disconnect at any time.
For example:
local carrying = character
local humanoid = character.Humanoid
humanoid:GetPropertyChangedSignal('Health'):Connect(function()
if humanoid.Health >= 100 then
Drop()
end
end)
Also little PS: youâre able to create a code block by using 3 `'s.
Just want to let you know about the difference between GetPropertyChangedSignal and the .Changed event.
.Changed is to detect if any property within an instance is changed, the property will be passed as the first argument to the connection
humanoid.Changed:Connect(function(property)
print(property) -- if the health changes, it will print 'Health'
if property == 'Health' then
print('Health was changed!')
end
end)
:GetPropertyChangedSignal is essentially the same, but it basically removes the need for the if statement. The property you put into the parentheses is for whichever property itâs listening and waiting to be changed.