Problem with ability

  1. What do you want to achieve? Keep it simple and clear! Im trying to make a Q ability for my game

  2. What is the issue? Include screenshots / videos if possible! When i press It doesnt work when pressing Q, even added print.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? None

its in a local script also

local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")

local deb = false

local player = Players.LocalPlayer

UserInputService.InputBegan:Connect(function(input, gameProcessed)

if player.Character:FindFirstChild("Attack") then
if input.UserInputType == Enum.UserInputType.MouseButton1 and not gameProcessed then
player.Character.Attack:FireServer()
end

if player.Character:FindFirstChild("AbilityQ") then
if input.UserInputType == Enum.KeyCode.Q and not gameProcessed then
player.Character.AbilityQ:FireServer()
end

end
end
end)
1 Like

Put the event in a different place other than the character and it should work. The character is controlled in the Client. So it probably wont work because of that. Let me know if it doesn’t work and I’ll help you troubleshoot the issue.

Also if that doesn’t work try editing your code so replace

input.UserInputType -> input.KeyCode

Well when i tried to make it on RightClick for the ability, it worked and not Q?

Did you change the input.UserInputType to input.KeyCode

I made it look like:
if player.Character:FindFirstChild(“AbilityQ”) then
if input.KeyCode == Enum.KeyCode.Q and not gameProcessed then
print(“yo”)
player.Character.AbilityQ:FireServer()
end
now it works, thank you

No problem please mark my response as a solution so people know what to do if they encounter this!