I set Self.Combo to 1 but it returns nil in my M1 Function
local combatm1 = {}
local ActionChecking = require(game.ReplicatedStorage.Modules.Stuff.ActionChecker)
local Animations = game.ReplicatedStorage.Animations.M1s
function combatm1.new(player : Player, CData : {})
local self = setmetatable({}, combatm1)
self.Player = player
self.Combo = 1
self.M1Held = false
return self
end
function combatm1:M1(player : Player, CData : {})
self.M1Held = true
local character = player.Character or player.CharacterAdded:Wait()
local weapon = CData.Weapon
local Animation = game.ReplicatedStorage.Animations.M1s[weapon]
while self.M1Held do
if character:GetAttribute("M1ing") == false then
task.spawn(function()
character:SetAttribute("M1ing", true)
task.wait(.5)
character:SetAttribute("M1ing", false)
end)
print(player.Name .. " Is Using " .. weapon .. " To M1!")
local M1Animation = character:WaitForChild("Humanoid"):LoadAnimation(Animation[self.Combo])
M1Animation:Play()
if self.Combo == 4 then
self.Combo = 1
else
self.Combo = self.Combo + 1
end
end
task.wait()
end
end
return combatm1