So I’m trying to make a script that lets players carry the player when the player is knocked. The problem I’m trying to fix is to release the player from getting carried ( animations, ragdolls, etc ) when the Carrying or GettingCarried Character is left. In order to do that, according to the script I made, it needs an object value of the knocked character and the carrying character. The function has to run either when the player that is carrying or being carried character is left so the character that is being carried or carrying do not left being getting stuck in a certain animation with anchored humanoid.
Each character has two values, Getting Carried and Carrying in which GettingCarried is the object value of the character carrying it and Carrying is the object value of the character you are carrying.
So my script is to detect when the Carrying or GettingCarried player is left. The problem is that it’s not detecting the value of the character when he leaves. ( I know that this cannot work this way cuz characters destroy first when the player is left )
So I tried Object Value to see if it updates when the player is left, This way is not working either.
If you know any way I can detect a value inside the player’s character when the player is left. Or from another existing character which is being carried or carrying?
My Code:
CCharacterStats.Carrying.Changed:Connect(function()
print("CARRYING VALUE CHANGED PROCESSING")
print(CCharacterStats.Carrying.Value)
if CCharacterStats.Carrying.Value == nil then
char.HumanoidRootPart.gripweld:Destroy()
for i,v in pairs(char.Humanoid:GetPlayingAnimationTracks()) do
v:Stop()
end
char.Humanoid.PlatformStand=false
char.HumanoidRootPart.Anchored = false
char.Humanoid.WalkSpeed = 16
player.DevComputerMovementMode = Enum.DevComputerMovementMode.UserChoice
end
end)
CCharacterStats.GettingCarried.Changed:Connect(function()
print("GETTING CARRIED VALUE CHANGED")
print(CCharacterStats.GettingCarried.Value)
if CCharacterStats.GettingCarried.Value == nil then
char.HumanoidRootPart.gripweld:Destroy()
for i,v in pairs(char.Humanoid:GetPlayingAnimationTracks()) do
v:Stop()
end
char.Humanoid.PlatformStand=false
char.HumanoidRootPart.Anchored = false
char.Humanoid.WalkSpeed = 16
player.DevComputerMovementMode = Enum.DevComputerMovementMode.UserChoice
if Humanoid.Health <= 20 and CCharacterStats.Knocked.Value == false then
KnockPlayer(player)
else
UnKnockPlayer(player)
end
end
end)