Grab ability not working like intended

why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why character:

----- Function -----
local function HandleCollision(Character,RootPart)
	local IsRagdolled=(AtrEdit.get(Character,"Ragdoll")or 0)>0
	for _,Limb in ipairs(Character:GetChildren())do
		if Limb:IsA("BasePart")then
			Limb.CollisionGroup,Limb.CanCollide,Limb.Massless=IsRagdolled and"Ragdoll"or"Player",false,true
		end
	end
	RootPart.CanCollide=(not AtrEdit.get(Character,"Grabbed")and not IsRagdolled)
	RootPart.Massless=(not AtrEdit.get(Character,"Grabbed")and not IsRagdolled)
	RootPart.Material=AtrEdit.get(Character,"Grabbed")and Enum.Material.SmoothPlastic or Enum.Material.Metal
end

local function VerifyCharacter(Character,Server)
	local Humanoid=Character:FindFirstChildOfClass("Humanoid")
	if Server and not Humanoid:FindFirstChildOfClass("Animator")then
		Instance.new("Animator",Humanoid)
	end
	return Humanoid,Character:FindFirstChild("HumanoidRootPart"),Humanoid:FindFirstChildOfClass("Animator")
end
----- Module/Server -----
function CharacterEditer.ConnectCharacter(Character)
	local Humanoid,RootPart=VerifyCharacter(Character,true)
	local Player=Services.Players:GetPlayerFromCharacter(Character)
	Character.PrimaryPart=RootPart

	for _,n in ipairs({"Animate","Health"})do
		local c=Character:FindFirstChild(n)
		if c then c:Destroy()end
	end
	for Name,Value in pairs(require(script.Attribute))do
		if not AtrEdit.get(Character,Name)then AtrEdit.set(Character,Name,Value)end
	end

	Humanoid.BreakJointsOnDeath,Humanoid.RequiresNeck,Humanoid.AutoRotate=false,false,false
	Humanoid.UseJumpPower=true

	local function Update()
		AtrEdit.set(Character,"Ragdoll",math.max(0,AtrEdit.get(Character,"Ragdoll")))
		HandleCollision(Character,RootPart)
	end

	local CollConn=Services.RunService.Heartbeat:Connect(Update)

	Character.AttributeChanged:Connect(function(a)
		if a=="Ragdoll"then
			(AtrEdit.get(Character,"Ragdoll")>0 and CharacterRagdoll.StartRagdoll or CharacterRagdoll.StopRagdoll)(Character)
		end
	end)

	Humanoid.Died:Connect(function()
		CollConn:Disconnect()
		AtrEdit.set(Character,"Ragdoll",4)
	end)
end
----- Module/Client -----
function CharacterEditer.ConnectController(Character)
	local Humanoid:Humanoid,RootPart=VerifyCharacter(Character)
	local Player,Camera=Services.Players:GetPlayerFromCharacter(Character),Services.Workspace.CurrentCamera
	local Dead,Connections=false,{}

	local function DisconnectAll()
		for _,c in ipairs(Connections)do c:Disconnect()end
	end

	local function Check()
		if not(Character:IsDescendantOf(Services.Workspace)and RootPart and Humanoid and Humanoid.Health>0)then
			Dead=true
			DisconnectAll()
			return false
		end
		return true
	end

	local function UpdateAttribute(A)
		if A:find("Speed")or A:find("Jump")or A=="Running"then
			local Running=AtrEdit.get(Character,"Running")
			local Speed=(Running and AtrEdit.get(Character,"RunSpeed")or AtrEdit.get(Character,"WalkSpeed"))*AtrEdit.get(Character,"SpeedMultiplier")
			local Power=(Running and AtrEdit.get(Character,"RunPower")or AtrEdit.get(Character,"WalkPower"))*AtrEdit.get(Character,"JumpMultiplier")
			Humanoid.JumpPower=Power
			Services.TweenService:Create(Humanoid,TweenInfo.new(AtrEdit.get(Character,Running and"RunAccel"or"RunDecel")),{WalkSpeed=Speed}):Play()
		end
	end

	local function RotateCharacter()
		local RotationSpeed,State=AtrEdit.get(Character,"RotationSpeed"),Humanoid:GetState()
		local Locked=Services.UserInputService.MouseBehavior==Enum.MouseBehavior.LockCenter
		local Climbing=State==Enum.HumanoidStateType.Climbing
		local MoveDir=Humanoid.MoveDirection
		local Direction=(not Climbing and not Locked and Vector3.new(MoveDir.X,0,MoveDir.Z))or(Locked and Vector3.new(Camera.CFrame.LookVector.X,0,Camera.CFrame.LookVector.Z))or Vector3.zero

		if Direction.Magnitude>.1 then
			local Target=CFrame.new(RootPart.Position)*CFrame.lookAt(Vector3.zero,Direction.Unit)
			Character:SetPrimaryPartCFrame(RootPart.CFrame:Lerp(Target,RotationSpeed/(Locked and 4 or 6)))
		end
	end

	table.insert(Connections,Humanoid.StateChanged:Connect(function(_,NewState)
		if NewState==Enum.HumanoidStateType.Jumping then
			AtrEdit.add(Character,"JumpDebounce",1)
			task.delay(2.8,function()AtrEdit.sub(Character,"JumpDebounce",1)end)
		end
	end))

	table.insert(Connections,Services.RunService.Heartbeat:Connect(function()
		if Dead or not Check()then return end
		if Player then
			AtrEdit.set(Character,"LookDirection",RootPart.CFrame:toObjectSpace(Camera.CFrame).LookVector)
			HandleCollision(Character,RootPart)
			if AtrEdit.get(Character,"Ragdoll")<=0 and AtrEdit.get(Character,"RotateDebounce")<=0 and not AtrEdit.get(Character,"Grabbed") then
				RotateCharacter()
			end
		elseif RootPart and RootPart:CanSetNetworkOwnership()then
			--RootPart:SetNetworkOwner(nil)
		end
	end))

	table.insert(Connections,Character.AncestryChanged:Connect(function(_,parent)
		if not parent then Dead=true DisconnectAll()end
	end))

	table.insert(Connections,Character.AttributeChanged:Connect(UpdateAttribute))

	UpdateAttribute("Running")
	CharacterAnimator.ConnectAnimator(Character)
end

why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why why ability:

		["Robert_1"] = function()
			local GrabAnimation = Animator:LoadAnimation(GameStorage.Animation.Ability[Animate].Grab)
			GrabAnimation:Play(0.02)

			local AttackHitbox=CreateHitBox({SpatialOption="InBox",SizeOrPart=Vector3.new(6,3.4,5),DebounceTime=4,Debug=Debug},RootPart,CFrame.new(0,0,-3))

			HandleHitboxAttack(Character, AttackHitbox, function(HitCharacter, HitRootPart, HitHumanoid:Humanoid)
				HitRootPart.Velocity = Vector3.zero
				HitRootPart.AssemblyLinearVelocity = Vector3.zero
				HitRootPart.AssemblyAngularVelocity = Vector3.zero

				local Weld = WeldTogether(Character["Left Arm"], HitRootPart, RootPart, {C0 = CFrame.new(-0.6, -2.2, 0.8) * CFrame.Angles(math.rad(90), 0, math.rad(180)),C1 = CFrame.new()})

				local HoldStart = Animator:LoadAnimation(GameStorage.Animation.Ability[Animate].HoldStart)
				local HoldLoop = Animator:LoadAnimation(GameStorage.Animation.Ability[Animate].HoldLoop)
				GrabAnimation:Stop(0)
				HoldStart:Play(0)

				AtrEdit.set(HitCharacter, "Grabbed", true)
				AtrEdit.set(HitCharacter, "CanMove", false)

				task.wait(HoldStart.Length)
				HoldLoop:Play(0)

				for i = 1, 40 do
					HitHumanoid:TakeDamage(1)
					task.wait(0.2)
				end

				HoldLoop:Stop()
				HoldStart:Play()

				AtrEdit.set(HitCharacter, "CanMove", true)
				AtrEdit.set(HitCharacter, "Grabbed", false)

				task.wait(1)
				AtrEdit.add(HitCharacter, "Ragdoll", 1)

				Weld:Destroy()

				task.wait(1)
				AtrEdit.sub(HitCharacter, "Ragdoll", 1)
			end)

			AddCooldownTable(Character, { "AbilityDebounce" }, 2)
			AddCooldownTable(Character, { "SpeedMultiplier" }, 0.5, 0.4)
			task.wait(0.5)
			AddCooldownTable(Character, { "SpeedMultiplier" }, 0.8, -0.8)
			HitboxAttack(AttackHitbox, 0.2)
			task.wait(2)
		end,

why why why why visualto:

I want grab like sonic exe disaster video game online on roblox fun videogaming!!!! roblox studio?? *no fun videogame.*no queston code becauuse it could look pretty bad, but you have to look at bright sides. it work, and work it will. very much dislike roblox online video game Ethernet physics

do not question the amount of “why”'s, it’s needed for my mental

1 Like

Another victim of roblox humanoid jank.

Same.

Try setting hit Humanoid platform stand to true or else the grabbed humanoid will resist arrest.

Also try setting root priority of the attacker higher cuz root part matters in welding.

3 Likes

I It now works completely.:partying_face::partying_face::partying_face::partying_face::partying_face::tada::tada::money_mouth_face::money_mouth_face::money_mouth_face::money_mouth_face::money_mouth_face::money_mouth_face: money face emoji​:money_mouth_face::money_mouth_face::money_mouth_face::money_mouth_face::money_mouth_face::money_mouth_face: Money-Mouth Face Emoji | Meaning, Copy And Paste :tada:
very cool!!!:money_mouth_face::money_mouth_face::money_mouth_face::money_mouth_face:
working!!!:money_mouth_face::money_mouth_face::money_mouth_face:::

2 Likes