Can you also make a video when the person is hit the person plays a hit anim so what mean is that when a player 1 punches the player 2 get attacked and gets hit and plays the anim but if the player 1 stop then the combo breaks(the get hit one)
it wont work even though everything is perfect but heres the code local rp = game:GetService("ReplicatedStorage") local remotes = rp:WaitForChild("Remotes") local combatRemote = remotes:WaitForChild("Combat") local animation = rp:WaitForChild("Animations") local combatAnims = animations:WaitForChild("Combat") local Players = game:GetService("Players") local MAX_COMBO = 4 Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) char:SetAttribute("Combo",0) end) end) local function changeCombo(char) local combo = char:GetAttribute("Combo") if combo < MAX_COMBO then char:SetAttribute("Combo", combo + 1) else char:SetAttribute("Combo",1) end end local function getAnimation(char) local combo = char:GetAttribute("Combo") local anims = combatAnims:GetChildren() local currAnim = anims[combo] return currAnim end combat.Remote.OnServerEvent:Connect(function(player) local char = player.Character local hum = char:WaitForChild("Humanoid") local humRp = char:WaitForChild("HumanoidRootPart") local animator = hum:FindFirstChildOfClass("Animator") or Instance.new("Animator",hum) local attacking = char:GetAttribute("Attacking") local punching = char:GetAttribute("Punching") print("Punch Easy") if attacking or punching then return end changeCombo(char) local punchAnim = getAnimation(char) local playAnimation = animtor:LoadAnimation(punchAnim) playAnimation:Play() end)
for anyone thats too lazy to write the script here local ts = game:GetService("TweenService") local border = script.Parent.PrimaryPart local moveUp = 20 local duration = 1 local negative = false local function move(part,negative) local tween if negative then tween = ts:Create(part,TweenInfo.new(duration,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{CFrame = part.CFrame * CFrame.new(0,-moveUp,0)}) else tween = ts:Create(part,TweenInfo.new(duration,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{CFrame = part.CFrame * CFrame.new(0,moveUp,0)}) end negative = not negative tween:Play() tween.Completed:Connect(function() move(part,negative) end) end move(border,negative)
For lazy guys Combat server: local rp = game:GetService("ReplicatedStorage") local remotes = rp:WaitForChild("Remotes") local combatRemote = remotes:WaitForChild("Combat") local ss = game:GetService("ServerStorage") local modules = ss:WaitForChild("Modules") local TomatoHitbox = require(modules:WaitForChild("TomatoHitbox")) local TomatoSlow = require(modules:WaitForChild("TomatoSlow")) local HitService = require(modules:WaitForChild("HitService")) local animations = rp:WaitForChild("Animations") local combatAnims = animations:WaitForChild("Combat") local Players = game:GetService("Players") local lastPunch = {} local MAX_COMBO = 4 Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) char:SetAttribute("Combo",0) end) end) local function changeCombo(char) local combo = char:GetAttribute("Combo") local player = game.Players:GetPlayerFromCharacter(char) if not lastPunch[player] then lastPunch[player] = os.clock() end local passedTime = os.clock() - lastPunch[player] if passedTime > 1.2 then char:SetAttribute("Combo", 1) else if combo < MAX_COMBO then char:SetAttribute("Combo", combo + 1) else char:SetAttribute("Combo", 1) end end lastPunch[player] = os.clock() end local function getAnimation(char) local combo = char:GetAttribute("Combo") local anims = combatAnims:GetChildren() local currAnim = anims[combo] return currAnim end local function calculateKnockback(attacker, enemy, power) local direction = -(attacker.HumanoidRootPart.Position - enemy.HumanoidRootPart.Position).unit local kb = direction * power return kb end combatRemote.OnServerEvent:Connect(function(player) local char = player.Character local hum = char:WaitForChild("Humanoid") local humRp = char:WaitForChild("HumanoidRootPart") local animator = hum:FindFirstChildOfClass("Animator") or Instance.new("Animator",hum) local attacking = char:GetAttribute("Attacking") local punching = char:GetAttribute("Punching") print("Punch Easy") if attacking or punching then return end char:SetAttribute("Attacking",true) char:SetAttribute("Punching",true) changeCombo(char) local ragdoll = false local ragdollDuration = 2 local punchAnim = getAnimation(char) local playAnimation = animator:LoadAnimation(punchAnim) task.spawn(function() repeat task.wait() until playAnimation.Length > 0 TomatoSlow.Stun(hum,playAnimation.Length,8) end) --Hitbox local hitbox = TomatoHitbox.new() hitbox.Size = Vector3.new(8,8,8) hitbox.CFrame = humRp hitbox.Offset = CFrame.new(0,0,-4) hitbox.Visualizer = true hitbox.onTouch = function(enemyHum) if enemyHum ~= hum then local enemy = enemyHum.Parent local knockback = calculateKnockback(char,enemy,10) local attackerKnockback = nil if char:GetAttribute("Combo") ~= MAX_COMBO then attackerKnockback = calculateKnockback(char,enemy,10) else ragdoll = true knockback = calculateKnockback(char,enemy,20) end HitService.hit(enemyHum,3.2,nil,knockback,attackerKnockback,char,ragdoll,ragdollDuration) end end playAnimation.KeyframeReached:Connect(function(kf) if kf == "Hit" then task.spawn(function() hitbox:Start() task.wait(0.1) hitbox:Stop() end) task.wait(0.12) char:SetAttribute("Attacking",false) if char:GetAttribute("Combo") == MAX_COMBO then task.wait(1.2) end char:SetAttribute("Punching",false) end end) playAnimation:Play() end) Hit Service: local debris = game:GetService("Debris") local modules = game:WaitForChild("ServerStorage"):WaitForChild("Modules") local RagdolHandler = require(modules:WaitForChild("RagdollHandler")) local module = {} function module.hit(enemyHum,damage,stunDuration,knockback,attackerKnockback,attacker,ragdoll,ragdollDuration) local enemy = enemyHum.Parent local enemyHumRp = enemy:WaitForChild("HumanoidRootPart") local attackerHumRp = attacker:waitForChild("HumanoidRootPart") if damage then enemyHum:TakeDamage(damage) end if knockback then local bv = Instance.new("BodyVelocity") bv.MaxForce = Vector3.new(100000,0,100000) bv.P = math.huge bv.Velocity = knockback bv.Parent = enemyHumRp debris:AddItem(bv,0.2) end if attackerKnockback then local bv = Instance.new("BodyVelocity") bv.MaxForce = Vector3.new(100000,0,100000) bv.P = math.huge bv.Velocity = attackerKnockback bv.Parent = attackerHumRp debris:AddItem(bv,0.2) end if ragdoll then RagdolHandler.Stun(enemyHum,ragdollDuration) end end return module
How do you access your animations via folder in Roblox studio? I only did the animations with the something called “Moon animator Suite” and I’m not sure how to make an animation event in that. Please help me.
I need helpy because when i load into roblox studio it has all the stuff but when i playtesdt it it doesnt do anything except for following and there is no knife