To make it easier for you, here is the entire code as a lot of it is cut out in the pictures I send, you might see something with the entire code.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Lighting = game:GetService("Lighting")
local groupinfo = require(ReplicatedStorage.GameInfoStorage.GroupInformation)
local PhysService = game:GetService("PhysicsService")
local PlayerGroup = PhysService:CreateCollisionGroup("p")
PhysService:CollisionGroupSetCollidable("p","p",false)
local PlayerGroup = PhysService:CreateCollisionGroup("a")
PhysService:CollisionGroupSetCollidable("a","a",true)
ReplicatedStorage.RemoteEvents.Ragdoll.OnServerEvent:Connect(function(plr,state)
plr.Character:WaitForChild("Ragdoll").Activate.Value = state
end)
function NoCollide(model,ownerchar)
print("GotExecuted (nocollide)")
for k,v in pairs(model:GetDescendants()) do
if v:IsA"BasePart" then
print(v)
PhysService:SetPartCollisionGroup(v,"p")
if not model == ownerchar.Character then
v:SetNetworkOwnership(ownerchar)
end
end
end
end
function Collide(model)
print("GotExecuted (collide)")
for k,v in pairs(model:GetDescendants()) do
if v:IsA"BasePart" then
PhysService:SetPartCollisionGroup(v,"a")
v:SetNetworkOwnership(nil)
end
end
end
ReplicatedStorage.RemoteEvents.Carry.OnServerEvent:Connect(function(plr,state,targetCharacter)
if targetCharacter ~= nil and game.Players:FindFirstChild(targetCharacter.Name) and plr.Character ~= targetCharacter then
if game.Players:FindFirstChild(targetCharacter.Name):WaitForChild("PlayerInfo").Roped.Value == true and targetCharacter:WaitForChild("Ragdoll").Activate.Value == true then -- already roped, remove.
game.Players:FindFirstChild(targetCharacter.Name):WaitForChild("PlayerInfo").Roped.Value = false
if targetCharacter.HumanoidRootPart:FindFirstChild("Restraints") then
targetCharacter.HumanoidRootPart:FindFirstChild("Restraints"):Destroy()
end
Collide(targetCharacter)
Collide(plr.Character)
else
if not targetCharacter.HumanoidRootPart:FindFirstChild("Restraints") and targetCharacter:WaitForChild("Ragdoll").Activate.Value == true then
game.Players:FindFirstChild(targetCharacter.Name):WaitForChild("PlayerInfo").Roped.Value = true
local Restraints = Instance.new("Folder",targetCharacter.HumanoidRootPart)
Restraints.Name = "Restraints"
local BallSocket = Instance.new("RopeConstraint")
BallSocket.Parent = Restraints
BallSocket.Attachment1 = plr.Character.LeftHand.LeftGripAttachment
BallSocket.Attachment0 = targetCharacter.HumanoidRootPart.RootRigAttachment
BallSocket.Length = 0.03
BallSocket.Visible = false
plr.Character.Humanoid:ChangeState(Enum.HumanoidStateType.Flying)
targetCharacter.Humanoid:ChangeState(Enum.HumanoidStateType.FallingDown)
NoCollide(targetCharacter,plr)
NoCollide(plr.Character,plr)
end
end
end
end)
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(character)
character.Ragdoll.Activate.Changed:Connect(function()
print("oop")
if plr.Character:WaitForChild("Ragdoll").Activate ~= true then
if plr.Character.HumanoidRootPart:FindFirstChild("Restraints") then
plr.Character.HumanoidRootPart:FindFirstChild("Restraints"):Destroy()
plr:WaitForChild("PlayerInfo").Roped.Value = false
end
end
end)
character:WaitForChild("Humanoid").Died:Connect(function()
if plr.Character:FindFirstChild("Head") then
if plr.Character.HumanoidRootPart:FindFirstChild("Restraints") then
plr.Character.HumanoidRootPart:FindFirstChild("Restraints"):Destroy()
plr:WaitForChild("PlayerInfo").Roped.Value = false
end
end
end)
end)
end)