I’ve used CAT to bind a bunch of keys to functions, but now the game doesn’t pick up any other inputs like equipping tools and moving the camera around. Not sure why this is happening?
--//Inputs
ContextActionService:BindAction("EquipMain", Controls.Sort, true, Enum.KeyCode.One)
ContextActionService:BindAction("EquipSecondary", Controls.Sort, true, Enum.KeyCode.Two)
ContextActionService:BindAction("Reload", Controls.Sort, true, Enum.KeyCode.R)
ContextActionService:BindAction("Mouse1", Controls.Sort, true, Enum.UserInputType.MouseButton1)
ContextActionService:BindAction("Mouse2", Controls.Sort, true, Enum.UserInputType.MouseButton2)
local module = {}
local M1 = false
local M2 = false
local function IsActive(Input,State)
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
local Character = Player.Character or Player.CharacterAdded:Wait()
for i,v in pairs(Character:GetChildren()) do
if v:IsA("Tool") then
if State == Enum.UserInputState.Begin then
local Table = require(game:GetService("ReplicatedStorage").Modules.PlayerModules[Player.Name])
print(Table)
local Module = require(game:GetService("ReplicatedStorage").Modules.GunModules[v.Name])
local Main = require(game:GetService("ReplicatedFirst"):WaitForChild("Loadout")[Table.Main.Name])
local ProjectileModule = require(script:WaitForChild("Projectile"))
shared.PrintPath.Print(Input)
if Input == "Mouse1" then
if Module.FireMode == 1 then
while M1 do
shared.PrintPath.Print("AutoFire")
game:GetService("ReplicatedStorage").RemoteEvent:FireServer({T="ToolActivated",Input=Input,State=State,MousePos=Mouse.Hit.p,Tool=v})
ProjectileModule.Basic(true,Mouse.Hit.p,v.FirePart.Position,Main.BulletSpeed)
wait(Module.FireRate)
end
elseif Module.FireMode == 2 then
for i = 1,Module.Burst do
shared.PrintPath.Print("BurstFire")
game:GetService("ReplicatedStorage").RemoteEvent:FireServer({T="ToolActivated",Input=Input,State=State,MousePos=Mouse.Hit.p,Tool=v})
ProjectileModule.Basic(true,Mouse.Hit.p,v.FirePart.Position,Main.BulletSpeed)
wait(Module.FireRate)
end
else
shared.PrintPath.Print("SemiFire")
game:GetService("ReplicatedStorage").RemoteEvent:FireServer({T="ToolActivated",Input=Input,State=State,MousePos=Mouse.Hit.p,Tool=v})
ProjectileModule.Basic(true,Mouse.Hit.p,v.FirePart.Position,Main.BulletSpeed)
wait(Module.FireRate)
end
end
if Input == "Reload" then
if not Main.Mag == Module.Mag then
shared.PrintPath.Print("Reload")
game:GetService("ReplicatedStorage").RemoteEvent:FireServer({T="ToolActivated",Input=Input,State=State,MousePos=Mouse.Hit.p,Tool=v})
end
end
end
break
end
end
end
function module.Sort(Input,State)
if Input == "Mouse1" or Input == "Mouse2" then
if Input == "Mouse1" then
if State == Enum.UserInputState.Begin then
M1 = true
IsActive(Input,State)
else
M1 = false
IsActive(Input,State)
end
elseif Input == "Mouse2" then
if State == Enum.UserInputState.Begin then
M2 = true
IsActive(Input,State)
else
M2 = false
IsActive(Input,State)
end
end
end
if Input == "Reload" then
if State == Enum.UserInputState.Begin then
IsActive(Input,State)
else
end
end
end
return module
