So In the quickest manner possible. My issue is, on the client I want a player to press a button, 1-4 or the corresponding key binds, (which will be interchangeable).
This is how it will be stored, In a table in the main client script.
How I want it to go is, when the player presses the button. If the button is found in the key binds table then it checks an unseen Boolean (Alt Move set) if it’s true, then it fires the alternative key binds index. Else, it’ll fire the normal key binds index into the server.
In an even shorter manner
Press button, check tables, if true, check if alt move set, fire pressed button index.
For the sake of convenience I would switch the key and values of both table
local serverevent = rep_Storage.Event
local uis = game.UserInputService
uis.InputBegan:Connect(function(i,p)
if p then return end
if Keybinds[i.KeyCode] then
if AltMoveSet then
serverevent:FireServer(AlternativeKeybinds[i.KeyCode])
else
serverevent:FireServer(Keybinds[i.KeyCode])
end
end
end)
Guys is this the most helpful dude on dev forum i see him everywhere??
Even though I did a bit of changing you helped in a sense
Final Working Code
uis.InputBegan:Connect(function(Input, GPE)
if GPE then return end
local Keys
if AltMoveset then
Keys = AlternativeKeybinds
print("Using Alternative Keys")
else
Keys = Keybinds
print("Using Normal Keys")
end
for i,v in pairs(Keys) do
if Input.KeyCode == v then
Ability:FireServer(i)
end
end
end)