Im trying to make a grab attack and I have two animations markers to start and end the grab, the first calls HoldEnemy from a module and then the other ends it by calling ReleaseEnemy from the same module, when testing with two players at first it would randomly choose to favour one of the players and no matter which player landed the grab, the favoured player would be able to move the other player around by turning their camera no matter who hit the move, after changing the code a bit to what it is now (makign it set network ownership to the hit player at the end of the grab instead of setting it to nil, and making grabbed players massles) it seems to have fixed the issue, as in now only the attacking player can spin the welded player around. BUT now, sometimes after landing the grab if you jump you get flinged in a specific direction each time and idk why it happens cuz the weld is destroyed and everything should be to how it was before the grab so ??? I'm probably just trying to do grab moves the wrong way so if anyone has more experience please help 😭
#Welding issues + weird fling bug
1 messages · Page 1 of 1 (latest)
local function ReleaseEnemy(EnemyCharacter)
local data = ActiveGrabs[EnemyCharacter]
if not data then return end -- no active grab
print("Releasing enemy")
local Weld = data.Weld
local Character = data.Character
local EnemyHum = EnemyCharacter:FindFirstChild("Humanoid")
local EnemyRoot = EnemyCharacter:FindFirstChild("HumanoidRootPart")
if EnemyHum then
EnemyHum.PlatformStand = false
end
EnemyRoot:SetNetworkOwner(game.Players:GetPlayerFromCharacter(EnemyHum.Parent))
for _, v in pairs(EnemyHum.Parent:GetChildren()) do
if v:IsA("BasePart") then
v.Massless = false
end
end
if Weld and Weld.Parent then
local newCF = Weld.Part0.CFrame * Weld.C0
Weld:Destroy()
EnemyRoot.CFrame = newCF
end
ActiveGrabs[EnemyCharacter] = nil
end
local function HoldEnemy(EnemyHum, Character, C0)
local data = ActiveGrabs[EnemyHum.Parent]
if data then return end
local EnemyRoot = EnemyHum.Parent.HumanoidRootPart
local PlayerRoot = Character.HumanoidRootPart
EnemyHum.PlatformStand = true
for _, v in pairs(EnemyHum.Parent:GetChildren()) do
if v:IsA("BasePart") then
v.Massless = true
end
end
local Weld = Instance.new("Weld")
Weld.Part0 = PlayerRoot
Weld.Part1 = EnemyRoot
Weld.C0 = C0
Weld.C1 = CFrame.new()
Weld.Parent = EnemyRoot
EnemyRoot:SetNetworkOwner(game.Players:GetPlayerFromCharacter(Character))
ActiveGrabs[EnemyHum.Parent] = {
Weld = Weld,
}
end
ok had a similiar problem and told it has to do with the welded model not being massless