Local Script
UserInputService.InputBegan:Connect(function()
local Modules = {}
for i, v in pairs(script.Interactions:GetChildren()) do
if (v:IsA("ModuleScript")) then
Modules[v.Name] = require(v)
end
end
for i, Keybind in pairs(Modules) do
local KeybindData = Keybind:ReturnKeybindData()
if(UserInputService:IsKeyDown(KeybindData.Key)) then
print(KeybindData.Key)
Keybind.KeyDown()
end
end
end)
KeybindModule
local API = {}
API.__index = API
local Data = {
["Name"] = "ShiftToSprint",
["Key"] = Enum.KeyCode.LeftShift,
["KeyDown"] = function ()
print("KeyPressed")
end,
["KeyUp"] = function()
print("KeyReleased")
end
}
function API:ReturnKeybindData()
return Data
end
return API
Getting this error:
[14:25:00.945 - ReplicatedFirst.Client:72: attempt to call a nil value]