I am currently working in a game about hitting people with rocks until they go uncounscious. The idea is that after they’re unconscious (ragdolled) otehr players can pick them up. What i did was set the ragdolled player’s torso CFrame to the CFrame of aan attachment in my character’s HumanoidRootPart, and created a weld so that the ragdolled player stays on top of my character.
The issue is that when I pick up the other player, my character starts rotating to the side.
Rotating Bug.wmv (6.0 MB)
Server:
script.Parent.Event.OnServerEvent:Connect(function(player, Num, Char1, Char2)
if Num == 1 then
--Char1.HumanoidRootPart.CFrame = Char2.HumanoidRootPart.CarryAttachment.WorldCFrame
Char1.HumanoidRootPart.CFrame = Char2.HumanoidRootPart:FindFirstChild("CarryAttachment").WorldCFrame
local Weld = Instance.new("WeldConstraint")
Weld.Parent = Char1.HumanoidRootPart
Weld.Name = "CarryWeld"
Weld.Part0 = Char2.HumanoidRootPart
Weld.Part1 = Char1.HumanoidRootPart
script.Parent.Carrying.Value = true
Char2.Torso.Massless = true
elseif Num == 2 then
repeat
Char1.HumanoidRootPart:FindFirstChild("CarryWeld"):Destroy()
wait()
Char1.HumanoidRootPart.CFrame = Char2.Head:FindFirstChild("DropAttachment").WorldCFrame
script.Parent.Carrying.Value = false
Char2.Torso.Massless = false
until not Char1.HumanoidRootPart:FindFirstChild("CarryWeld")
elseif Num == 3 then
repeat
Char1.HumanoidRootPart:FindFirstChild("CarryWeld"):Destroy()
until not Char1.HumanoidRootPart:FindFirstChild("CarryWeld")
wait()
--local
Char1.HumanoidRootPart.CFrame = Char2.Head:FindFirstChild("DropAttachment").WorldCFrame
script.Parent.Carrying.Value = false
Char2.Torso.Massless = false
end
end)
DetectClick:
local Player = game.Players.LocalPlayer
--local Char = Player.Character
local mouse = Player:GetMouse()
local UIS = game:GetService("UserInputService")
local Current
script.Parent.Equipped:Connect(function()
mouse.Button1Down:Connect(function()
if script.Parent.Parent == Player.Character then
local Target = mouse.Target
if Target:FindFirstAncestorWhichIsA("Model") then
if Target:FindFirstAncestorWhichIsA("Model"):FindFirstChildOfClass("Humanoid") then
if Target:FindFirstAncestorWhichIsA("Model"):FindFirstChildOfClass("Humanoid").Health > 0 then
local Model = Target:FindFirstAncestorWhichIsA("Model")
local Hum = Model:FindFirstChildOfClass("Humanoid")
print(Model.Name)
if (Hum.Parent:FindFirstChild("Torso").Position - Player.Character.Torso.Position).Magnitude < 5 then
print("Found")
if Model:FindFirstChild("Ragdolled") and script.Parent.Carrying.Value == false then
if Model.Ragdolled.Value == true then
script.Parent.Event:FireServer(1, Model, Player.Character)
Current = Model
print("Fired with player")
end
else
script.Parent.Event:FireServer(1, Model, Player.Character)
Current = Model
print("Fired with dummy")
end
end
end
end
end
end
end)
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Q then
if script.Parent.Parent == Player.Character then
if script.Parent.Carrying.Value == true then
script.Parent.Event:FireServer(3, Current, Player.Character)
Current = nil
end
end
end
end)
end)
script.Parent.Unequipped:Connect(function()
if Current then
print("Current wasnt nil")
script.Parent.Event:FireServer(2, Current, Player.Character)
Current = nil
end
end)
Thanks in advance