Hey there!
I am currently working on a neck snapping animation. Essentially the player will have their neck snapped (via played animation,) and then fall to the ground via ragdoll. Here is the ragdoll module I am currently using: R15 / Rthro Ragdolls.
The issue I am facing reverts the animation (turns head back into original position,) then ragdolls the character. I believe I originally had it working properly but I forgot what I changed since then.
Here is my relevant code:
As you can see, I integrated a flag to enable/disable killing all character animations. This does not fix my issue. This is a LocalScript.
local LocalPlayer = game:GetService("Players").LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Events = ReplicatedStorage:WaitForChild("Events")
local RagdollHandler = ReplicatedStorage:WaitForChild("Scripts").RagdollHandler
require(ReplicatedStorage:WaitForChild("Scripts").buildRagdoll)(LocalPlayer.Character.Humanoid)
require(RagdollHandler)
Events.Ragdoll.OnClientEvent:Connect(function(Humanoid, KillAnimation)
local Character = Humanoid.Parent
local setEnabled = Humanoid:GetState() ~= Enum.HumanoidStateType.Physics
Humanoid:ChangeState(setEnabled and Enum.HumanoidStateType.Physics or Enum.HumanoidStateType.GettingUp)
Character.Animate.Disabled = setEnabled
if setEnabled and KillAnimation then
for _,v in pairs(Humanoid:GetPlayingAnimationTracks()) do
v:Stop(0)
end
end
end)
Next, here is the server code which fires the Ragdoll remote event.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Events = ReplicatedStorage:WaitForChild("Events")
local ChangeEnergy = Events.ChangeEnergyBindable
local TS = game:GetService("TweenService")
local anim = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations["NeckSnap"])
anim:Play()
anim:AdjustSpeed(0)
-- ragdoll and neck snap animation
TS:Create(anim, TweenInfo.new(0.3), {TimePosition = 0.15}):Play()
wait(0.3)
Events.Ragdoll:FireAllClients(Humanoid, false)
-- revive
wait(10)
Events.Ragdoll:FireAllClients(Humanoid, true)
Any help would be greatly appreciated. I have been stuck on this problem for a couple days now.