So I honestly have no idea what I’m doing lmao i’m just roughly trying to create what I wanna do, but basically I’m trying to recreate 1 character from Street Fighter and not gonna lie I have no idea how to do the input this is what I came up with I know it’s very incorrect probably, but idk hopefully someone that sees will know what I’m trying to do and could help me.
Basically though I’m trying to make it so if whatever the player inputs matches an input in the module script then do stuff yeah.
local debounces = {}
local holding = {}
local playerInputs = "" --I wanna make this a table for each input or for the most recent inputs
local characterInputs = {}
spawn(function()
while wait() do
for i,v in pairs(characterInputs) do
if playerInputs == v then
print("Player inputted "..playerInputs)
playerInputs = "" --reset it
end
end
end
end)
--put the inputs for each move into characterInputs
for i,v in pairs(moveData["M. Bison"]) do
for i,v in pairs(v) do
print(i,v.Input) --name of move & input for it
table.insert(characterInputs,v.Input)
end
end
local controls = {
["G"] = function(Input)
playerInputs = playerInputs..Input
end,
["H"] = function(Input)
end,
["J"] = function(Input)
end,
["B"] = function(Input)
end,
["N"] = function(Input)
end,
["M"] = function(Input)
end,
["W"] = function(Input)
end,
["A"] = function(Input)
playerInputs = playerInputs..Input
end,
["S"] = function(Input)
end,
["D"] = function(Input)
playerInputs = playerInputs..Input
end,
}
UIS.InputBegan:Connect(function(Input, isTyping)
if isTyping then
return
end
local key = UIS:GetStringForKeyCode(Input.KeyCode)
if controls[key] and not debounces[key] then
print(key)
debounces[key] = true
--[[
spawn(function()
wait(3)
local held = UIS:IsKeyDown(key)
if held then
print(key.. " is being held")
holding[key] = true
controls[UIS:GetStringForKeyCode(Input.KeyCode)](key)
end
end)
]]
controls[UIS:GetStringForKeyCode(Input.KeyCode)](key)
spawn(function()
wait(1)
debounces[key] = false
end)
end
end)