Clicker game giving 2 clicks?

I’m working on a clicker game, and whenever the player clicks, it gives them 2 clicks. The script is not firing twice, I’ve already tested for that. (I made it print every time the player clicked, and it only printed once.)

There is a datastore called “multiplier” which should multiply the players clicks. In this case, the multiplier was set to 1 so it shouldn’t do anything.

Additionally, when setting the multiplier to something high such as 100, it gives 149 clicks instead.

there’s obviously a math issue somewhere, with no code we can’t do much

game.ReplicatedStorage.killPlayer.OnServerEvent:Connect(function(plr)
	plr.datastores.Strength.Value = plr.datastores.Strength.Value + plr.datastores.Multiplier.Value
end)
game.ReplicatedStorage.killPlayer.OnServerEvent:Connect(function(plr)
	local NewValue = plr.datastores.Strength.Value * plr.datastores.Multiplier.Value
    print(NewValue )
    plr.datastores.Strength.Value = NewValue 

Theres a problem with that when you add a multiplier. It multiplies your current amount of clicks, when it’s supposed to multiply 1. For example, if you have a multiplier of 2, it should give you 2 clicks every time you click the button. If you have a multiplier of 10, it should add 10 clicks to your current amount of clicks.

oh wait

game.ReplicatedStorage.killPlayer.OnServerEvent:Connect(function(plr)
	plr.datastores.Strength.Value += 1 * plr.datastores.Multiplier.Value
end)

Turns out I just had 2 scripts that were both doing the same thing, it works now.

1 Like

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