I am trying to make a script that fires a death beam when the F key is pressed, however I am getting an error on line 14.
elseif input.Keycode == Enum.KeyCode.F then
In the output, I’m getting a message saying keycode is not a valid member of inputobject. How do I fix this?
local Player = game:GetService("Players").LocalPlayer
local UIS = game:GetService("UserInputService")
local debounce = false
local cooldown = 3
local rp = game:GetService("ReplicatedStorage")
local Death = rp:WaitForChild("Death")
UIS.InputBegan:Connect(function(input, IsTyping)
if IsTyping then
return
elseif input.Keycode == Enum.KeyCode.F then
if debounce == false then
debounce = true
Death:FireServer()
end
end
end)
Death.OnClientEvent:Connect(function()
wait(cooldown)
debounce = false
end)