local Script in StarterPlayer:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Modules = ReplicatedStorage:WaitForChild("Modules")
local InteractiveMouse = require(Modules:WaitForChild("InteractiveMouse"))
local WorkerDrag = require(Modules:WaitForChild("WorkerDrag"))
local MouseButtonUp = InteractiveMouse.CreateListener("MouseButtonUp")
local MouseButtonDown = InteractiveMouse.CreateListener("MouseButtonDown")
local LastCharacter
local Character = Instance.new("ObjectValue")
MouseButtonUp.Bindable.Event:Connect(function(player,Mouse:PlayerMouse)
if not Mouse.Target then return end
local Model = Mouse.Target:FindFirstAncestorWhichIsA("Model")
if not Model then return end
local HasTag = Model:HasTag("Worker")
if not HasTag then return end
Character.Value = Model
end)
MouseButtonDown.Bindable.Event:Connect(function(player,Mouse)
if not Character.Value then return end
Character.Value = nil
end)
Character.Changed:Connect(function(value)
if value then
WorkerDrag.RagdollOn(Character.Value)
LastCharacter = Character.Value
else
task.wait(1)
WorkerDrag.RagdollOff(LastCharacter)
end
end)
WorkerDrag Module:
local WorkerDrag = {}
local RunServie = game:GetService("RunService")
local Remote = script.Remote
function WorkerDrag.RagdollOn(Char:Model)
local Humanoid = Char:FindFirstChildWhichIsA("Humanoid")
Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
for _, v in pairs(Char:GetDescendants()) do
if v:IsA("Motor6D") then
local Attachment0 = Instance.new("Attachment",v.Part0) local Attachment1 = Instance.new("Attachment",v.Part1)
local BallSocket = Instance.new("BallSocketConstraint", v.Parent)
BallSocket.Attachment0 = Attachment0
BallSocket.Attachment1 = Attachment1
Attachment0.CFrame = v.C0
Attachment1.CFrame = v.C1
if v.Part1.Name == "Right Arm" or v.Part1.Name == "Left Arm" then
else
BallSocket.TwistLimitsEnabled = true
BallSocket.LimitsEnabled = true
BallSocket.TwistLowerAngle = -15
BallSocket.TwistUpperAngle = 15
BallSocket.UpperAngle = 15
end
v:Destroy()
end
end
Remote:FireServer(Char,true)
end
function WorkerDrag.RagdollOff(Char:Model)
for _, v in pairs(Char:GetDescendants()) do
if v:IsA("BallSocketConstraint") then
local Motor = Instance.new("Motor6D")
Motor.Part0 = v.Attachment0.Parent
Motor.Part1 = v.Attachment1.Parent
Motor.C0 = v.Attachment0.CFrame
Motor.C1 = v.Attachment1.CFrame
Motor.Parent = v.Parent
v:Destroy()
end
end
for _, v in pairs(Char:GetDescendants()) do
if v:IsA("Attachment") then
v:Destroy()
end
end
local Humanoid = Char:FindFirstChildWhichIsA("Humanoid")
Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
Remote:FireServer(Char,false)
end
if RunServie:IsServer() then
Remote.OnServerEvent:Connect(function(player:Player,Char:Model,bool)
if bool then
for _, v in pairs(Char:GetDescendants()) do
if v:IsA("BasePart") then
v.CanCollide = true
v.CollisionGroup = "Ragdoll"
v:SetNetworkOwner(player)
end
end
else
for _, v in pairs(Char:GetDescendants()) do
if v:IsA("BasePart") then
v.CollisionGroup = "Default"
end
end
end
end)
end
return WorkerDrag
DragDetector properties:
Video (Warning, loud music):
Anyways, now that I have all code sources out here, I wish to ask for help, few of my concerns are flinging, as you guys can see it’s really easy to do and throw NPC out of their starting X axis, which is for the sake of this game supposed to stay the same.
Another concern of mine is Stifness in arms, legs seem to be really interactive while arms stay the same unless I violently try shaking it. I tried fixing this one by adding limit on ballsockets in legs, but with no restrictions in arms, sadly it’s not making any difference.
So personally I need help and ideas how I could make this system “Calmer”, By that I mean for parts to rotate less around drag detector, For arms to be less stiff and be as responsive as legs, and for flinging to be impossible.