I tried to make a script that allowed the user to use a dash like ability but the UserInputService wouldn't detect when someone pressed a key. Can anyone Help? This is my code:
local Remote = script:WaitForChild("Remote")
local UIS = game:GetService("UserInputService")
local DB = false
local Cooldown = 10
UIS.InputBegan:Connect(function(IsTyping, Input)
if script.Parent.Equipped == true then
if IsTyping then return end
if Input.KeyCode == Enum.KeyCode.X and DB == false then
DB = true
Remote:FireServer()
print('Fired')
end
else return
end
end)
Remote.OnClientEvent:Connect(function()
wait(Cooldown)
DB = false
end)
This is what I have on the other script which detects if the remote is fired .
local Remote = script.Parent
Remote.OnServerEvent:Connect(function(player)
end)

2 comments
Your code will work, but you need to explain it for future scripters to understand.
See help to learn how to format a question/answer properly: https://scriptinghelpers.org/help/how-post-good-questions-answers