My goal is so make the titan player grab the target on the ground and it stays on his arm. I did this by welding the target to the titan character’s arm so it stays and sticks, but the issue is that the movement is very unusual when a target is grabbed.
I tried making the target’s humanoidrootpart massless to true but it doesn’t seem to do anything. Moreover, I look through all other posts regarding similar issues and can’t seem to find a solution to this.
game.ReplicatedStorage.TitanRemotes.GrabRemote.OnServerEvent:Connect(function(player)
print("grab")
player.Character.Humanoid:LoadAnimation(script.Parent.Animation.Grab):Play()
local hitbox2 = script.Parent.Models.Hitbox:Clone()
hitbox2.Parent = player.Character
hitbox2.Massless = true
hitbox2.CFrame = player.Character["Right Arm"].CFrame * CFrame.new(0, -13, 0)
hitbox2.Orientation = hitbox2.Orientation + Vector3.new(0, 0, 0)
-- Create WeldConstraint
local weldConstraint = Instance.new("WeldConstraint", hitbox2)
weldConstraint.Part0 = hitbox2
weldConstraint.Part1 = player.Character["Right Arm"]
-- Add hitbox to Debris for cleanup after 0.8 seconds
game.Debris:AddItem(hitbox2, 0.9)
--player.Character.HumanoidRootPart.EnableFluidForces = false
hitbox2.Touched:connect(function(hit)
if hit.Parent == player.Character then return end
if hit.Parent.Humanoid then
hitbox2:Destroy()
hit.Parent.HumanoidRootPart.Massless = true
hit.Parent.Humanoid.AutoRotate = false
hit.Parent.HumanoidRootPart.Anchored = false
--- hit.Parent.HumanoidRootPart.RootPriority = -10
local weld = Instance.new("Weld",hit.Parent.HumanoidRootPart)
weld.Part0 = hit.Parent.HumanoidRootPart
weld.Part1 = player.Character["Right Arm"]
weld.C0 = CFrame.new(0,15,0)
end
end)
end)
for _, part in pairs(hit.Parent:GetDescendants()) do if part:IsA("BasePart") then
part.Massless = true
part.CanCollide = false
part.Anchored = false
end
end
I tried messing with the collision groups but to no avail, nothing changed.
game.ReplicatedStorage.TitanRemotes.GrabRemote.OnServerEvent:Connect(function(player)
print("grab")
player.Character.Humanoid:LoadAnimation(script.Parent.Animation.Grab):Play()
local hitbox2 = script.Parent.Models.Hitbox:Clone()
hitbox2.Parent = player.Character
hitbox2.Massless = true
hitbox2.CFrame = player.Character["Right Arm"].CFrame * CFrame.new(0, -13, 0)
hitbox2.Orientation = hitbox2.Orientation + Vector3.new(0, 0, 0)
-- Create WeldConstraint
local weldConstraint = Instance.new("WeldConstraint", hitbox2)
weldConstraint.Part0 = hitbox2
weldConstraint.Part1 = player.Character["Right Arm"]
-- Add hitbox to Debris for cleanup after 0.8 seconds
game.Debris:AddItem(hitbox2, 0.9)
--player.Character.HumanoidRootPart.EnableFluidForces = false
local touchConnection
touchConnection = hitbox2.Touched:Connect(function(hit)
if hit.Parent == player.Character then return end
if hit.Parent:FindFirstChild("Humanoid") then
touchConnection:Disconnect()
hitbox2:Destroy()
local PhysicsService = game:GetService("PhysicsService")
for _,v in pairs(player.Character:GetChildren()) do
if v:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(v, "GrabbedCollision")
end
end
for _,v in pairs(hit.Parent:GetChildren()) do
if v:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(v, "GrabbedCollision")
v.Massless=true -- Make the bad massless
v.CanCollide = false
end
end
--- hit.Parent.HumanoidRootPart.RootPriority = -10
local weld = Instance.new("Weld",hit.Parent.HumanoidRootPart)
weld.Part0 = hit.Parent.HumanoidRootPart
weld.Part1 = player.Character["Right Arm"]
weld.C0 = player.Character["Right Arm"].CFrame:ToObjectSpace(hit.Parent.HumanoidRootPart.CFrame) * CFrame.new(0, 15, 0)
end
end)
end)
idk if it will help ur case as much as it did me long ago,
Try putting the Titan’s PrimaryPart.RootPriority = --Any number higher than the grabbed.PrimaryPart.RootPriority
local touchConnection
touchConnection = hitbox2.Touched:Connect(function(hit)
if hit.Parent == player.Character then return end
if hit.Parent:FindFirstChild("Humanoid") then
touchConnection:Disconnect()
hitbox2:Destroy()
--- hit.Parent.HumanoidRootPart.RootPriority = -10
-- Create an AlignPosition instance
-- Check if "Holder" exists in the player's character
player.Character.PrimaryPart = player.Character.HumanoidRootPart
hit.Parent.PrimaryPart = hit.Parent.HumanoidRootPart
player.Character.HumanoidRootPart.RootPriority = 1
hit.Parent.HumanoidRootPart.RootPriority = -1
local weld = Instance.new("Weld",hit.Parent.HumanoidRootPart)
weld.Part0 = hit.Parent.HumanoidRootPart
weld.Part1 = player.Character["Right Arm"]
weld.C0 = CFrame.new(0,15,0)
for _, part in pairs(hit.Parent:GetDescendants()) do if part:IsA("BasePart") then part.Massless = true end end
end
end)
end)
Doesn’t seem to do anything, the weird movement still occur
I tried, I set everything to the max so it creates like a sort of “glued” or “weld” effect so it follows exactly where it goes without delay. But issue is that, this only applies visually in server sides, when it is in client sided, you can clearly see the delay where the target is following/tailing behind rather than having that “weld” effect.