Hello! I’m having an issue where when I grab a player. It fails and I sink to my knees underground and completely get stuck. I’m trying to make it so when you grab someone they are stuck in front of you and you can still walk. Sorry that it sounds confusing, but there are no errors. Any questions please ask.
local timeNeeded = 5
local captured = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:WaitForChild("Humanoid", 1) then
if hit.Parent:WaitForChild("Infected", 1) then
if hit.Parent.Infected.Value == false then
if hit.Parent:WaitForChild("UpperTorso", 1) then
if captured == false then
captured = true
local plrName = script.Name
local char = game.Workspace:FindFirstChild(plrName)
char.Humanoid.WalkSpeed = 5
if script.Parent then
hit.Parent.LowerTorso.CFrame = script.Parent.CFrame + Vector3.new(0,0.6,0)
end
for _, part in pairs(hit.Parent:GetChildren()) do
if part:IsA("BasePart") then
part.Position += Vector3.new(0,0.4,0)
part.Massless = true
end
end
local weldCon = Instance.new("WeldConstraint")
weldCon.Parent = char
weldCon.Part0 = script.Parent
weldCon.Part1 = hit.Parent:WaitForChild("HumanoidRootPart")
task.wait(timeNeeded)
hit.Parent.Infected.Value = true
char.Humanoid.WalkSpeed = 16
if script.Parent then
weldCon:Destroy()
script.Parent:Destroy()
end
end
end
end
end
end
end)
task.wait(1.25)
if captured == false then
if script.Parent then
script.Parent:Destroy()
end
end