How to add key to get up from ragdoll

I have a thing that makes player ragdoll but i want to add a key to make player get up from ragdoll
for example:
when player get ragdolled,player press E to get up from ragdoll

https://developer.roblox.com/en-us/api-reference/class/UserInputService

using event to destroy the ragdoll weld thingy?

everytime the player presses the E button. Check if player is in ragdoll then call the function that breaks the ragdoll.

local userInput = game:GetService("UserInputService")

local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

userInput.InputBegan:Connect(function(key, processed)
	if processed then return end
	
	if key.KeyCode == Enum.KeyCode.E then
		humanoid:ChangeState(Enum.HumanoidStateType.PlatformStanding)
	end
end)

You may want to add a debounce (to prevent spamming).