Carrying System

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.

1 Like

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.

Ex.

```
local variable = Value
```
3 Likes

Thanks, I actually never knew that. Also, the scripted worked.

No worries!

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.

humanoid:GetPropertyChangedSignal('Health'):Connect(function()
    print('Health')
end)

Now if the humanoid’s MaxHealth property changes for example, it won’t fire because the MaxHealth property is not the Health property.

1 Like