What do you want to achieve?
I want to fire a RemoteEvent when E pressed
What is the issue?
The scripts works perfectly fine, but when I walk diagonally to the right and the press E (holding W + D and pressing then E ) it doesnt detect that E is pressed. But when I walk diagonally to the left (holding W + A and pressing then E) it works tho.
What solutions have you tried so far?
I tried using different events for UserInputService
but it still didnt work. I was searching on the dev forum, didnt work.
This is one script I was using
local inputservice = game:GetService("UserInputService")
local remoteevent = game.ReplicatedStorage.ROll
local player = game.Players.LocalPlayer
local function dashrequest()
local keyspressed = inputservice:GetKeysPressed()
for _, key in ipairs(keyspressed) do
if (key.KeyCode == Enum.KeyCode.E) then
remoteevent:FireServer(player)
end
end
end
inputservice.InputBegan:Connect(dashrequest)
And before you even begin telling me using an other even, I did.
local inputservice = game:GetService("UserInputService")
local remoteevent = game.ReplicatedStorage.ROll
local player = game.Players.LocalPlayer
local function dashrequest(input)
if input.KeyCode == Enum.KeyCode.E then
remoteevent:FireServer(player)
end
end
inputservice.InputBegan:Connect(dashrequest)
You don’t need to add player to the remote event, it is already being passed through. I would recommend adding prints and see what line the script stops printing. If it prints then add prints to your server script to see.
When im walking to the right diagonaly im pressing E and nothing prints but when Im doing anything else rather than walking diagonally to the right it works
The problem is not the server trust me. Its hard to explain, whenever I try to Roll (pressing E) it works, but when I try Rolling while im walking diagonaly to the right it doesnt work
local ContextActionService = game:GetService("ContextActionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage.ROll
function dash(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
Remote:FireServer()
end
end
ContextActionService:BindAction("Dash", dash , true, Enum.KeyCode.E)