local down = true local player = game.Players.LocalPlayer local mouse = player:GetMouse() local we = false local wee = game:GetService("UserInputService") wee.InputBegan:Connect(function(input) if input == Enum.KeyCode.Q then game.ReplicatedStorage.events.Fire:FireServer() end end) --mouse.KeyUp:Connect(function(key) -- lol i tryed keyheld ;-; --key = key:lower() --if key == "q" then wee.InputEnded:Connect(function(input) if input == Enum.KeyCode.Q then print("23") game.ReplicatedStorage.events.Fire:FireServer() game.ReplicatedStorage.events.metor:FireServer(game.Players.LocalPlayer:GetMouse()) end end)
Hey. Your code is technically right, but it doesn't work for some reason. What you have to do is set a local value with the KeyCode and then check if the KeyCode is Q. It is explained better in this code.
local plr = game.Players.LocalPlayer local InputService = game:GetService("UserInputService") InputService.InputBegan:Connect(function(input) local key = input.KeyCode --Gets the key that the player pressed if key == Enum.KeyCode.Q then --Checks if the key is Q --Do whatever here end end) InputService.InputEnded:Connect(function(input) local key = input.KeyCode if key == Enum.KeyCode.Q then --Do whatever here end end)
I don't know why this error happens, but this is the way I solved it.
I hope I helped.
-VewixxPlayer
On line 8 and 18 you need to change:
if input == Enum.KeyCode.Q then
To the InputObject KeyCode property to compare key codes from the Input
if input.KeyCode == Enum.KeyCode.Q then