You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I need to make a Loop that properly iterates through the code and perform that specific function for defined action. -
What is the issue? Include screenshots / videos if possible!
No real issue but other than needing help trying to call functions for used inputs. I’m utilizing BindAction and to my knowledge you can pass specific functions to achieve this but the way i would like it set up is so everything needed would be in a table and searched for.
local cas = game:GetService("ContextActionService")
local KeyInput = {
["Dashing"] = {
actionName = "QDashInput",
Function = function(plr, char, humanoid)
local Attachment = Instance.new("Attachment")
Attachment.Name = "VelocityAttachment"
Attachment.Parent = char.HumanoidRootPart.CFrame
local ForwardDirection = char.HumanoidRootPart.CFrame.LookVector
local Lv = Instance.new("LinearVelocity")
Lv.Attachment0 = Attachment
Lv.MaxForce = 50000
Lv.VectorVelocity = ForwardDirection * 50
task.wait(0.25)
Lv:Destroy()
Attachment:Destroy()
end,
CancreateTouchButton = true,
Keybind = {Enum.KeyCode.Q},
},
["Running"] = {
actionName = "RunningInput",
Function = function()
print("I am Running")
end,
CancreatTouchButton = false,
Keybind = {}
}
}
function InputsMod.BindActions(actionName, keyInput, plr, char, humanoid)
for _, Keyinputs in pairs(KeyInput) do
cas:BindAction(
KeyInput.actionName,
KeyInput.CancreateTouchButton
)
end
end
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried searching directly on the dev forums for a topic relating this but couldn’t find a relevant topic, I’m not sure what to try!