My input began function is firing twice when it detects input?
When E is pressed the output shows “True True”. When click is detected it fires the remote twice.
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local remote = game.ReplicatedStorage:WaitForChild("PunchM1")
local damage = 10
local debounce = false
local combat = false
UIS.InputBegan:Connect(function(input, chat)
if not chat then
if input.KeyCode == Enum.KeyCode.E and not combat then
combat = true
print(combat)
elseif input.KeyCode == Enum.KeyCode.E and combat then
combat = false
print(combat)
end
if input.UserInputType == Enum.UserInputType.MouseButton1 and combat then
remote:FireServer()
end
end
end)