InputBegan/InputEnded firing twice

I think it might be something in ShootService

maybe try checking if your mouse is outputting more than 1 time

It’s not, it’s 100% a problem with the input.

Send the module. There is nothing wrong with the script you’ve sent so it must be something else.

Yeah, but how would it print it twice if ShootService has nothing to do with the print statement

function MT:OnInput(char: Model, isHolding: boolean, isSprinting: boolean)
	if isHolding and not isSprinting and self.debounce == false and not self.IsShooting and self.AntiDoubleClick < 1 then
		self.AntiDoubleClick += 1
		local plr = Players:GetPlayerFromCharacter(char)
		
		self.debounce = true
		self:ToggleShoot(true)
		
		ShootAnimationModule.PlayShoot(char)
		
		local mouse = plr:GetMouse()
		
		local attachPart = Instance.new("Part", workspace.Effects)
		attachPart.Anchored = true
		attachPart.Transparency = 1
		attachPart.CanCollide = false
		local attach1: Attachment? = char.Handle.Attachment0
		local attach2 = Instance.new("Attachment", attachPart)
		local beam = Replicated.Assets.VFX.Shoot.ShootBeam:Clone()
		beam.Parent = workspace.Effects	
		beam.Attachment0 = attach1
		
		attach2.CFrame = mouse.Hit
		beam.Attachment1 = attach2
		
		game.Debris:AddItem(beam, 1)
		game.Debris:AddItem(attach2, 1)
		game.Debris:AddItem(attachPart, 1)
		
		local hitChars = {}
		
		if mouse.Target.Parent:FindFirstChildWhichIsA("Humanoid") and not table.find(hitChars, mouse.Target.Parent) then
			table.insert(hitChars, mouse.Target.Parent)
			
			local char = mouse.Target.Parent
			char.Humanoid:TakeDamage(6)
		end
		
		
		
		self:ToggleShoot(false)
		
		task.wait(2)
		self.AntiDoubleClick = 0
		
		self.debounce = false
	end
end

Go to your output window and click the three dots and make sure stack lines is enabled. Try the script again and send a screenshot of the output.

It’s already enabled._________

try this
local UserInputService = game:GetService(“UserInputService”)

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		print("Click")
	end
end)

if it printed more than 1 time when u click then the proplem isnot in your script at all

Changing the name of the variable isn’t gonna fix anything.

We already tried this. char limti???

i amnot talking about the variables input began only fires the event when u click once
just try it and see many times it outputs when you click

Read further up in the thread. They tried this in a new place and confirmed it wasn’t an issue.

My whole point is that it’s not firing once.

Try this. This would narrow things down.

Just fixed it, I just had to create a new script and copy the code and name of the old one.

For anyone who’s also having this problem, here’s the answer I guess.
Still no idea why that even happens.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.