#Trying to make m1’s and it won’t work

1 messages · Page 1 of 1 (latest)

rare monolith
#

I’ve check the code from the tutorial I was using and I’ve seemed to have exactly matched it but when I load into test it isn’t working. Can someone let me know if my code would work?

Input manager code:
local plrs = game:GetService("Players")
local lp = plrs.LocalPlayer
local mouse = lp:GetMouse()

local m1Script = script.WaitForChild("M1")
local m1BF = m1Script:WaitForChild("Function")

mouse.Button1Down:Connect(function()

m1BF:Invoke()

end)

And for the M1 Script:
local bindableFunction = script:WaitForChild("Function")

local rs = game:GetService("ReplicatedStorage")
local rsAnimationsFolder = rs:WaitForChild("Animations")

local plrs = game:GetService("Players")
local lp = plrs.LocalPlayer
local char = lp.Character or lp.CharacterAppearanceLoaded:Wait()
local hum = char:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")

local m1sPerformed = 0

local currentM1 = 0

local m1Debounce = false

local comboEndCooldown = 2

local waitBeforeReset = 0.5

bindableFunction.OnInvoke = function()

if not m1Debounce then

    m1Debounce = true

    m1sPerformed += 1
    currentM1 += 1

    local correspondingM1anim = rsAnimationsFolder:FindFirstChild("M1 ("..currentM1..")")

    local m1Track = animator:LoadAnimation(correspondingM1anim)

    m1Track:Play()

    task.wait(m1Track.Length - 0.1)

    task.spawn(function()

        local oldM1sPerformed = m1sPerformed

        task.wait(waitBeforeReset)

        if oldM1sPerformed == m1sPerformed then

            currentM1 = 0

        end

    end)

    if currentM1 == 4 then

        task.wait(comboEndCooldown)

        currentM1 = 0

    end

    m1Debounce = false

end

end

gilded kernel
rare monolith
#

Ok I’ll check when I get home but is it fine if I ask again if that’s not the problem?