I am using CompletedLoop’s Ragdoll Script for my fighting game. Ive noticed, however, it seems that the limbs and head dont follow the torso for other clients and the server. It only shows up correctly for the player who’s ragdolled. I found this out when I activated the ragdoll and kept it active for a few seconds. On both the server and other clients, the torso is the only part the moves. The limbs and head slightly move then stay frozen in one place until ragdoll is deactivated. Maybe this has something to do with the knockback force im giving the character? I dont know. Here are some pieces of code that are related to the issue:
This is part of a script that includes this thing for punching players:
local Char = Humanoid.Parent
local StatManager = require(Char.StatManager)
local AttackInfo = {}
AttackInfo.Damage = 10
AttackInfo.Knockback = (HumanoidRootPart.CFrame * CFrame.Angles(math.rad(45), 0, 0)).LookVector * 35
AttackInfo.Stun = .85
AttackInfo.Ragdoll = true
local Return = StatManager.TakeDamage(AttackInfo)
if Return == "Hit" or Return == "Kill" then
local PunchSound = SFX.PunchSound:Clone()
PunchSound.Parent = Char.HumanoidRootPart
PunchSound:Destroy()
VFXModule.PunchEffect(Char.HumanoidRootPart)
end
The VFXModule (idk if this is part of the problem or not just being safe and providing everything within this part of the code):
function VFXModule.PunchEffect(Part)
local Effect = VFX.PunchEffect:Clone()
Effect.Parent = VFXHolder
Effect.CFrame = Part.CFrame
local Weld = Instance.new("Weld")
Weld.Part0 = Part
Weld.Part1 = Effect
Weld.Parent = Effect
wait()
Effect.Attachment.Emitter:Emit(1)
Debris:AddItem(Effect, 1)
end
The TakeDamage() Function in the StatsManager Module-Script:
function StatManager.TakeDamage(AttackInfo)
--Function won't continue if the attack is blocked and is not block-breaking
if FightMode.Value == 0 or FightMode.Value == 3 then return "CantHit" end
if StatManager.Blocking == true and not AttackInfo.BlockBreak then return "Blocked" end
local ShieldMult = 1 - math.clamp(StatManager.Shield/100, 0, 1)
if AttackInfo.Stun then
StatManager.Stun.Tick = tick()
StatManager.Stun.Time = AttackInfo.Stun
StatManager.Stun.Ragdoll = AttackInfo.Ragdoll or false
end
if AttackInfo.Knockback then
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.Parent = HumanoidRootPart
BodyVelocity.MaxForce = Vector3.one * math.huge
BodyVelocity.Velocity = AttackInfo.Knockback * ShieldMult
Debris:AddItem(BodyVelocity, .1)
end
StatManager.Health -= AttackInfo.Damage * ShieldMult
--print(AttackInfo.Damage * ShieldMult)
if StatManager.Health <= 0 then
return "Kill"
end
return "Hit"
end
And last but not least, a function that runs every step of the RunService in the StatManager Module-Script:
function OnStep(Time, DeltaTime)
--print('a')
if TT > .75 and StatManager.Health > 0 then
StatManager.Health = math.clamp(StatManager.Health+StatManager.HealthRegen, 0, StatManager.MaxHeatlh)
TT = 0
end
Humanoid.Health = StatManager.Health
Humanoid.MaxHealth = StatManager.MaxHeatlh
Humanoid.WalkSpeed = StatManager.WalkSpeed
Humanoid.JumpPower = StatManager.JumpPower
IsRagdoll.Value = false
FightMode.Value = 1
if tick() - StatManager.Stun.Tick < StatManager.Stun.Time then
Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0
IsRagdoll.Value = StatManager.Stun.Ragdoll
FightMode.Value = 2
end
TT += DeltaTime
end
Please help! i dont want my fighting game to have this laggy ragdolling in it. I would provide footage, but roblox wont let me for some reason soooo...