So I’m making a ragdoll effect and I have this weird jittery effect when activaated. I just want player to lie there but not looking like they having a seizure lol. What should i do?
function Effects.Ragdoll(char)
local RagScriptClone = script:FindFirstChild("Ragdoll"):Clone()
RagScriptClone.Parent = char
RagScriptClone.Disabled = false
game.ReplicatedStorage.RagdollEvent:FireAllClients(char.Name, "Ragdoll") -- fire an event to the client
char.Humanoid.JumpPower = 0 -- make sure they cant jump
for _, v in pairs(char:GetDescendants()) do -- looping through the character
if v:IsA("BasePart") and v.Name == "Head" or v.Name == "LowerTorso" then -- welding them so they can't move
local weld = Instance.new("Weld")
weld.Part0 = char.HumanoidRootPart
weld.Part1 = v
weld.C0 = char.HumanoidRootPart.CFrame:inverse()
weld.C1 = v.CFrame:inverse()
weld.Parent = char.HumanoidRootPart
weld.Name = "RagdollWeld"
end
if v:IsA("Motor6D") and char.Humanoid.RigType == Enum.HumanoidRigType.R15 then-- adding an attachment and constraint for each
local attachment1 = Instance.new("Attachment")
local attachment0 = Instance.new("Attachment")
attachment0.Name = "Attachment0"
attachment1.Name = "Attachment1"
attachment0.CFrame = v.C0
attachment1.CFrame = v.C1
attachment0.Parent = v.Part0
attachment1.Parent = v.Part1
local constraint = Instance.new("BallSocketConstraint") -- change to BallSocketConstraint if you want
constraint.Attachment0 = attachment0
constraint.Attachment1 = attachment1
constraint.Parent = v.Part0
v:Destroy()
local attachment1 = Instance.new("Attachment")
local attachment0 = Instance.new("Attachment")
attachment0.Name = "Attachment0"
attachment1.Name = "Attachment1"
attachment0.CFrame = v.C0
attachment1.CFrame = v.C1
attachment0.Parent = v.Part0
attachment1.Parent = v.Part1
local constraint = Instance.new("BallSocketConstraint") -- change to BallSocketConstraint if you want
constraint.Attachment0 = attachment0
constraint.Attachment1 = attachment1
constraint.Parent = v.Part0
v.Part0 = nil
end
end
end
function Effects.RagdollStand(char, humanoid)
char.Humanoid.JumpPower = 50 -- changing jump to 50
char.Humanoid.PlatformStand = false
char:FindFirstChild("Ragdoll"):Destroy()
for _, v in pairs(char:GetDescendants()) do -- destorying all things we created
if v.Name == "Attachment0" or v.Name == "Attachment1" or v:IsA("Weld") and v.Name == "RagdollWeld" or v:IsA("BallSocketConstraint") then -- change HingeConstraint to ballsocketconstraint if thats what you chose
v:Destroy()
end
end
if humanoid.RigType == Enum.HumanoidRigType.R6 then
for _, v in pairs(char:GetDescendants()) do
if v:IsA("Motor6D") then
v.Part0 = v.Parent
end
end
else
humanoid:BuildRigFromAttachments() -- Only works with R15
end
game.ReplicatedStorage.RagdollEvent:FireAllClients(char.Name, "Stand") -- fire the standing event to the client
end
--client
remote.OnClientEvent:connect(function(Target,Type)
for i,v in pairs(workspace:GetDescendants()) do -- Dealing Damage
if v:IsA("Model") and v.Name == Target then
if Type == "Ragdoll" then
camera.CameraSubject = character.Head
--humanoid:ChangeState("Physics")
humanoid:ChangeState(Enum.HumanoidStateType.Physics)
print("GUCCI")
end
end
end
if Type == "Stand" then
camera.CameraSubject = character.Humanoid
humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
end
end)