duvie
(duvie)
July 16, 2020, 10:16pm
#1
Here is the code.
local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
local BodyVelocity = Instance.new("BodyVelocity", HumanoidRootPart)
BodyVelocity.Velocity = Vector3.new(0,10,0) + HumanoidRootPart.CFrame.LookVector * 200
Humanoid.Ragdoll:Connect(function(True)
wait(0.5)
Humanoid.Ragdoll:Connect(function(False)
BodyVelocity:Destroy()
I’m trying too have the person who gets knocked back from this to ragdoll, but I have no idea how. Could someone help? I’d greatly appreciate it
2 Likes
Redridge
(Red)
July 16, 2020, 10:21pm
#3
Try using:
Humanoid.ChangeState(Enum.HumanoidStateType.Ragdoll)
1 Like
Try getting the humanoid in the character:
local Humanoid = Character.Humanoid
-- or :FindFirstChild or :WaitForChild
From here, you can make the character ragdoll by using Humanoid:ChangeState
to change to a HumanoidStateType
enum:
Humanoid:ChangeState(Enum.HumanoidStateType.FallingDown)
You can also use Physics
or PlatformStanding
. I think the Ragdoll
enum won’t be very responsive, please prove me wrong.
You can also change the PlatformStand
property:
Humanoid.PlatformStand = true
And you can also use the cool ragdoll resource if you want the character to turn into the traditional definition of a ragdoll:
I had previously made a ragdoll model in 2016, but there were a number of engine-level shortcomings that made it flawed:
There were no twist limits for BallSocketConstraints, so shoulders would happily turn all the way around where your inner armpit was on the outside of the character
There was no Humanoid.BreakJointsOnDeath property, which made it impossible to support things like preserving welded armor/etc on ragdolls, and made it difficult to support accessories/tools
There was no NoCollis…
3 Likes
duvie
(duvie)
July 16, 2020, 10:44pm
#5
Im tryin but it keeps saying Im indexing Humanoid with Nil. I did
local character = Game.Players.localPlayers.Character
local Humanoid = character:WaitForChild(“Humanoid”)
This isnt exact with capitals and w/e just an example of what I tried but it keeps saying its nil. ANyw ideas?
duvie
(duvie)
July 16, 2020, 10:48pm
#6
Heres waht i did
local Character = game.Players.LocalPlayer.Character
local Humanoid = Character.Humanoid
it keeps saying [attempt to index nil with ‘Character’
duvie
(duvie)
July 16, 2020, 10:53pm
#8
I’ve tried that aswell its not working no idea why.
When are you trying to run this code? If you run this code right when the player joins, they won’t have a character yet, and if you run it after they’ve died, the character will be different.
Player | Documentation - Roblox Creator Hub is an event that passes a character argument for you to use, and every time the character changes the event fires again.
And are you running this code on the server or client?
duvie
(duvie)
July 16, 2020, 11:07pm
#10
This part is being run on the server, is that an issue?
If it’s on the server, you should use the PlayerAdded
event:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid")
-- do ragdoll stuff here
end)
end)
2 Likes
Redridge
(Red)
July 17, 2020, 7:14am
#12
You cannot use LocalPlayer
in a server script. Only in local scripts. Maybe show more of the code to see where it should be placed.
1 Like