Can't click while someone else is clicking

Hello everyone!

There is a big bug in my game, so I decided to ask the users of the DevForum for help :smiley:.

I have a simple clicker button that when you click, it gives you a click.

This is a very simple button. When you click the button, I fire a remote event from the client to the server and I add clicks to the player’s leaderstats. Simple…

For some reason, in-game, when multiple people are playing, you cannot click at the exact same time as another person.

I tested this is one of my friends. I made him use a slow auto clicker in my game. Because he clicks so fast, I have no chance to click because he is auto clicking?

Can you guys help?

Thanks

-GreenTreeGamingYT

Can we see the scripts you’re using?

Sure:

Local Script:

script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.EggHatchingRemotes.GiveClicks:FireServer()
	
	script.Parent:TweenSize(UDim2.new(0.06, 0, 0.117, 0), Enum.EasingDirection.In, Enum.EasingStyle.Sine, 0.04, true, nil)
	wait(0.02)
	script.Parent:TweenSize(UDim2.new(0.076, 0, 0.149, 0), Enum.EasingDirection.In, Enum.EasingStyle.Sine, 0.04, true, nil)
	
	script:WaitForChild("ClickSound"):Play()
end)

ServerScript:

game.ReplicatedStorage.EggHatchingRemotes.GiveClicks.OnServerEvent:Connect(function(player)
	if db == true then
		local goUpBy = ((1 * tonumber(player.Values.Multiplier1.Value)) + player.RebirthMultiplier.Value)
		
		db = false
		player.leaderstats.Clicks.Value += goUpBy
		player.TotalClicks.Value += goUpBy
		wait(timeCooldown)
		db = true
	end
end)

Your server db applies to everyone because it’s the server. And so 2 events try to fire, but one is still in cooldown and doesn’t preform

So try to make a client side system, instead on the server

Alright, let me try. I will respond once I am done.

1 Like

Thank you @OfficialPogCat, it worked :smiley:

I have marked your response as a solution!

1 Like

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