I have created a grab animation for my game but no matter what I try it just won’t work. In the middle of the animation (seen below), something goes wrong and it breaks entirely. I’ve tried nearly every solution under the sun, including checking the priority, making sure the torso doesn’t intercept with the ground, trying to play through a local script, repeatedly playing the animation through the script, and remaking the animation entirely. I’m utterly stumped on what to do.
This is the video that shows what happens. What I did to the dummy was what was supposed to happen —
https://streamable.com/p63jdw
This is what’s in the serverscript:
grab.OnServerEvent:Connect(function(player)
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local grabstartupanim = humanoid:LoadAnimation(grabstartup)
local hrp = character:WaitForChild("HumanoidRootPart")
local limb = character:WaitForChild("Right Arm")
local torso = character:WaitForChild("Torso")
local hitbox = meshes:WaitForChild("grabhitbox"):Clone()
local weld = Instance.new("Weld")
local folder = Instance.new("Folder",character)
humanoid.WalkSpeed = 0
grabstartupanim:Play()
wait(0.85)
folder.Name = "Melee"
hitbox.CFrame = hrp.CFrame
hitbox.Parent = folder
debris:AddItem(folder,.5)
weld.Part0 = hitbox
weld.Part1 = limb
weld.C0 = weld.Part1.CFrame:toObjectSpace(weld.Part1.CFrame+Vector3.new(0,1,0))
weld.Parent = weld.Part0
unabletosprintgrab:FireClient(player)
hitbox.Touched:Connect(function(hit,direction)
print("it got touch")
local hitplayerhum = hit.Parent:FindFirstChild("Humanoid")
local hitplayerchar = hit.Parent
local hitplayer = hitplayerchar.Parent
local hitplayerhead = hitplayerchar:FindFirstChild("Head")
local hitplayertorso = hitplayerchar:FindFirstChild("Torso")
local hitplayerrp = hit.Parent:FindFirstChild("HumanoidRootPart")
local bvelocity = Instance.new("BodyVelocity")
bvelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bvelocity.Velocity = Vector3.new(0,70,0) + hrp.CFrame.LookVector*125
bvelocity.P = math.huge
local enemygrabanim = hitplayerhum:LoadAnimation(enemygrab)
local playergrabanim = humanoid:LoadAnimation(playergrab)
local a = Instance.new("BillboardGui", hitplayerhead)
local rando = math.random(-25, 25) / 20
local lolidk = 0.5
local b = Instance.new("TextLabel", a)
if hit:IsA("BasePart") then
if not hit:IsDescendantOf(character) then
if hitplayerhum then
local blockaction = hitplayerhum:FindFirstChild("blockaction")
if blockaction then
hitbox:Destroy()
else
hitbox:Destroy()
unabletosprint:FireClient(player)
grabreturn:FireClient(player)
local enemygrabanim = hitplayerhum:LoadAnimation(enemygrab)
local playergrabanim = humanoid:LoadAnimation(playergrab)
hitplayertorso.CFrame = CFrame.new((hrp.CFrame*CFrame.new(0,0,-5)).p,(hrp.CFrame*CFrame.new(0,0,0)).p)
torso.CFrame = CFrame.new((hitplayerrp.CFrame*CFrame.new(0,0,-5)).p,(hitplayerrp.CFrame*CFrame.new(0,0,0).p))
hitplayerrp.Locked = true
hrp.Locked = true
hitplayerhum.WalkSpeed = 0
humanoid.WalkSpeed = 0
for i, anims in pairs(humanoid:GetPlayingAnimationTracks()) do
if anims then
anims:Stop()
end
end
for i, anims in pairs(hitplayerhum:GetPlayingAnimationTracks()) do
if anims then
anims:Stop()
end
end
enemygrabanim:Play()
playergrabanim:Play()
wait(0.35)
hitplayerhum:TakeDamage(5)
a.Size = UDim2.new(2.5, 0, 2.5, 0)
a.AlwaysOnTop = true
a.SizeOffset = Vector2.new(rando, lolidk +0.5)
b.AnchorPoint = Vector2.new(0,0.5);
b.BackgroundTransparency = 1
b.BorderSizePixel = 0
b.Size = UDim2.new(1, 0, 1, 0)
b.Font = "PermanentMarker"
b.Text = 5
b.TextScaled = true
b.TextColor3 = Color3.new(0, 0, 0)
b.TextSize = 1
wait(0.675)
a.Enabled = false
a.SizeOffset = Vector2.new(rando, lolidk +0.5)
wait(0.675)
hitplayerhum:TakeDamage(5)
b.Text = 5
a.Enabled = true
wait(0.35)
a.Enabled = false
a.SizeOffset = Vector2.new(rando, lolidk +0.5)
wait(0.15)
hitplayerhum:TakeDamage(5)
b.Text = 5
a.Enabled = true
wait(0.725)
a.Enabled = false
a.SizeOffset = Vector2.new(rando, lolidk +0.5)
wait(0.5)
hitplayerhum:TakeDamage(20)
b.Text = 20
a.Enabled = true
hitplayerhum.WalkSpeed = 16
humanoid.WalkSpeed = 16
bvelocity.Parent = hitplayerrp
wait(0.1)
bvelocity:Destroy()
wait(0.1)
a:Destroy()
hitplayerrp.Locked = false
hitplayertorso.CanCollide = true
hrp.Locked = false
end
end
end
end
if humanoid then
hitplayerhum.WalkSpeed = 16
end
end)
grab:FireClient(player)
wait(0.5)
humanoid.WalkSpeed = 16
end)
This is the localscript:
local player = game:GetService("Players").LocalPlayer
local rs = game:GetService("RunService")
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local currenthealth = humanoid.Health
local weaponvalue = player.PlayerScripts:WaitForChild("weaponvalue")
local uis = game:GetService("UserInputService")
local attackingdebounce = false
local debounce = false
local strongpdebounce = false
local roundkickdebounce = false
local grabdebounce = false
local valuejajaja = 6.6
local isbroken = script.Parent:WaitForChild("isbroken")
local currenttime = 0
local previoustime = 0
local counter = 0
local rp = game:GetService("ReplicatedStorage")
local punchcb = rp:WaitForChild("punchcb")
local spunch = rp:WaitForChild("spunch")
local roundkick = rp:WaitForChild("roundhousekick")
local grab = rp:WaitForChild("grab")
local grabreturn = rp:WaitForChild("grabreturn")
humanoid.HealthChanged:Connect(function()
if humanoid.Health < currenthealth then
print("it knows the health got changed")
local folder = character:FindFirstChildWhichIsA("Folder")
if folder then
folder:Destroy()
end
debounce = true
strongpdebounce = true
roundkickdebounce = true
grabdebounce = true
currenthealth = humanoid.Health
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,false)
wait(2)
debounce = false
strongpdebounce = false
roundkickdebounce = false
grabdebounce = false
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,true)
end
end)
humanoid.StateChanged:Connect(function(old,new)
if new == Enum.HumanoidStateType.Jumping then
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,false)
wait(2.5)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,true)
end
end)
uis.InputBegan:Connect(function(input, gpa)
if gpa then
return
elseif input.UserInputType == Enum.UserInputType.MouseButton1 or input.KeyCode == Enum.KeyCode.R or input.KeyCode == Enum.KeyCode.E or input.KeyCode == Enum.KeyCode.T then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
local blockaction = humanoid:FindFirstChild("blockaction")
if blockaction then
return
end
if attackingdebounce == true then
return
end
if debounce == false and isbroken.Value == false then
debounce = true
currenttime = tick()
local passedtime = currenttime - previoustime
if passedtime < 1 then
counter = counter + 1
if counter == 5 or counter > 4 then
wait(2)
counter = 1
end
else
counter = 1
end
punchcb:FireServer(counter)
end
end
if input.KeyCode == Enum.KeyCode.R then
print("it registers the r")
local blockaction = humanoid:FindFirstChild("blockaction")
if blockaction then
return
end
if strongpdebounce == false and isbroken.Value == false and attackingdebounce == false then
attackingdebounce = true
strongpdebounce = true
spunch:FireServer()
end
end
if input.KeyCode == Enum.KeyCode.E then
print("it registers the e")
local blockaction = humanoid:FindFirstChild("blockaction")
if blockaction then
return
end
if roundkickdebounce == false and isbroken.Value == false and attackingdebounce == false then
attackingdebounce = true
roundkickdebounce = true
roundkick:FireServer()
end
end
if input.KeyCode == Enum.KeyCode.T then
local blockaction = humanoid:FindFirstChild("blockaction")
if blockaction then
return
end
if grabdebounce == false and isbroken.Value == false and attackingdebounce == false then
grabdebounce = true
attackingdebounce = true
grab:FireServer()
end
end
end
end)
punchcb.OnClientEvent:Connect(function()
previoustime = currenttime
attackingdebounce = false
wait(0.5)
debounce = false
end)
spunch.OnClientEvent:Connect(function()
wait(0.5)
attackingdebounce = false
wait(4.5)
strongpdebounce = false
end)
roundkick.OnClientEvent:Connect(function()
wait(0.5)
attackingdebounce = false
wait(2.5)
roundkickdebounce = false
end)
grab.OnClientEvent:Connect(function()
wait(0.5)
attackingdebounce = false
wait(14.5)
grabdebounce = false
end)
grabreturn.OnClientEvent:Connect(function()
local folder = character:FindFirstChildWhichIsA("Folder")
repeat
wait(0.01)
humanoid.WalkSpeed = 0
valuejajaja = valuejajaja - 0.06
debounce = true
strongpdebounce = true
roundkickdebounce = true
grabdebounce = true
if folder then
folder:Destroy()
end
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,false)
until valuejajaja <= 0
debounce = false
strongpdebounce = false
roundkickdebounce = false
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,true)
valuejajaja = 6.6
humanoid.WalkSpeed = 16
end)
Please excuse the damage indicators, I need to fix those later lol