#combat scripting not working

1 messages · Page 1 of 1 (latest)

mystic whale
sly crag
#

uno minute

teal crownBOT
#

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

sly crag
mystic whale
sly crag
#

heres part of it m1 is supposed to do the punches but it dont work
local function getAnimation(char, keyDown, currentCharacter)
local values = char:WaitForChild("Values")
local hum = char:WaitForChild("Humanoid")

local values = char:WaitForChild("Values")
local combo = values:FindFirstChild("Combo")

local Type = "M1"
local animation = assets.Animations[currentCharacter].Combat["Punch"..combo.Value]

if combo.Value >= 4 then
    if hum:GetState() == Enum.HumanoidStateType.Freefall or hum.FloorMaterial == Enum.Material.Air then
        animation = assets.Animations[currentCharacter].Combat.Downslam
        Type = "Downslam"
    elseif keyDown then
        animation = assets.Animations[currentCharacter].Combat.Uppercut
        Type = "Uppercut"
    end
end

return Type, animation

end

amber narwhal
#

what do you mean not work

#

it dosent do damahe?

#

damage*

sly crag
#

just flat out using m1 doesnt work

#

like i load into the game nun happens

amber narwhal
#

so it dosent play the animations?

sly crag
#

no

amber narwhal
#

so

#

what dosent work

#

the clicking?

sly crag
#

ye

amber narwhal
#

add print statements to see if your script is working

#

for example print("clicked")

sly crag
#

in a diff new script?

amber narwhal
#

no

#

same

#

ill give you it

sly crag
#

ty

#

theres abt 1k lines of code on this script

amber narwhal
#

`local function getAnimation(char, keyDown, currentCharacter)
local values = char:WaitForChild("Values")
local hum = char:WaitForChild("Humanoid")

local combo = values:FindFirstChild("Combo")

print("combo value: " .. combo.Value)  -- check combo value

local Type = "M1"
local animation = assets.Animations[currentCharacter].Combat["Punch"..combo.Value]

if combo.Value >= 4 then
    print("combo value is >= 4")  -- combo is 4 or more
    if hum:GetState() == Enum.HumanoidStateType.Freefall or hum.FloorMaterial == Enum.Material.Air then
        print("in freefall or air, switching to downslam")  -- player in freefall or air, switch to downslam
        animation = assets.Animations[currentCharacter].Combat.Downslam
        Type = "Downslam"
    elseif keyDown then
        print("uppercut triggered")  -- uppercut condition triggered
        animation = assets.Animations[currentCharacter].Combat.Uppercut
        Type = "Uppercut"
    end
end

print("keyDown: " .. tostring(keyDown))  -- check if keyDown is true
print("final animation: " .. animation)  -- final animation selected
return Type, animation

end
`
when you call getAnimation it will print whether keyDown is true (when you press M1) or false (if not)

it will also continue to print the rest of the information like the combo value the final selected animation and any other important info

sly crag
#

lemme try

sly crag
amber narwhal
#

what part dosent work

sly crag
#

still the punch doesnt work