Morning guys! I started scripting this morning and have been stuck in the same glitch as yesterday, I’m trying to make a system where a player can drag another dead player (ragdolled) with him, I did that but the dead player keeps glitching out, I tried doing while loops and such, but still bad, can anyone help?
Script:
local character = script.Parent
local animation = game:GetService("ReplicatedFirst").PushAnimation
local detector = Instance.new("Part",workspace)
local pushAnimation = nil
local debounce = true
detector.Name = "PushDetector"
detector.Transparency = 0.5
detector.Size = Vector3.new(4,5,4)
detector.Anchored = false
detector.CanCollide = false
detector.Position = character.HumanoidRootPart.Position + character.HumanoidRootPart.CFrame.LookVector * 5
local function onCharacterTouched()
character:FindFirstChild("Right Leg").Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("Humanoid").Health == 0 then
wait(1)
local function repeatMoving()
local weld = Instance.new("Weld")
weld.Parent = character
hit.Parent:MoveTo(character.HumanoidRootPart.Position + character.HumanoidRootPart.CFrame.LookVector * 1.5)
weld.Part0 = character:FindFirstChild("Torso")
weld.Part1 = hit.Parent:FindFirstChild("Torso")
--while wait(1) do
--character["RagdollOnDeathScript "].Disabled = true
--hit.Parent:MoveTo(character.HumanoidRootPart.Position + character.HumanoidRootPart.CFrame.LookVector * 1.5)
--end
end
spawn(repeatMoving)
end
end)
end
spawn(onCharacterTouched)
Gif on how it glitches
https://gyazo.com/e5a568178b41694e25d50f46785350bb