#bugged combo system need help (not my script)

40 messages · Page 1 of 1 (latest)

empty chasm
#

i need help fixing this script

<local rp = game:GetService("ReplicatedStorage")
local remotes = rp:WaitForChild("Remotes")

local punchRemote = remotes:WaitForChild("Punch")

local MAX_COMBO = 4 
local function changeCombo(char)
local combo = char:GetAttribute("Combo")
if combo >= MAX_COMBO then  
char:SetAttribute("combo",1)
else 
        char:SetAttribute("combo",combo + 1)
    end
    end
local function getPunchAnim(char)
local combo = char:GetAttribute("combo")
local punchAnims = animations:WaitForChild("Combat"):GetChildren()

local currAnim = punchAnim[combo]
return currAnim 
end    

punchRemote.OnServerEvent:Connect(function(player)
local char = player.Character
local hum = char:WaitForChild("Humanoid")
local humRp = char:WaitForChild("HumanoidRootPart")

local attacking = char:GetAttribute("Attacking")
local punching = char:GetAttribute("punch")

if attacking or punching then return end
char:SetAttribute("attacking",true)
char:SetAttribute("punching",true)

changeCombo(char)

local playPunchAnim = hum:LoadAnimation(getPunchAnim(char))
playpunchAnim.KeyframeReached:Connect(function(kf)
if kf == "Hit" then
char:SetAttribute("Attacking",false)
if char:GetAttribute("Combo") == MAX_COMBO then 
task.wait(1)
end
char:SetAttribute("Punch",false)
        end
    end)
    
playPunchAnim:play()

end)> it says ServerScriptService.CombatServer:9: attempt to compare number <= nil
empty chasm
#

thx

#

wait so do i just replace my entire code with this

#

wait

#

hmmm

#

im new to lua so i dont know what you mean

#

oh

#

ok

#

i completely failed

#

i set combo in a diffrent server script

#

wait

#

no i didnt

#

crap how do i define it

#

hmm alr ig ill try to fix it

#

idk what to set it as ._.

#

kk

#

does this work?

#

breh same error i think i did it wrong

#

oh

#

wdym

#

the local if then and end?

#

i dont think those i written wrong cuz i pressed tab to autofill it

#

oh underlined

#

bro still the same line of code

#

it keeps saying ServerScriptService.CombatServer:9: attempt to compare number <= nil

#

and idk why this is so dumb

empty bayBOT
#

studio** You are now Level 3! **studio

empty chasm
#

i got the scripting knowledge of a toddler bro

#

you gotta dumb it down for me

#

oh

#

ok i think what your saying is to change this part

#

= char:GetAttribute("Combo")
if combo >= MAX_COMBO then
char:SetAttribute("combo",1)

#

i did

#

this is exactly what he put

#

and it dont wanna work

#

every time i follow a tutorial

#

it never works

#

i cant make a single working script

#

thats why i came here

#

wdym