Value depends on amount of players (bug)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to achieve an increasing value of money (100) after the task is done.

  2. What is the issue? Include screenshots / videos if possible!
    If 1 person is playing the game, money increases by 100.
    If there’s 2 people, it increases by 200 etc.
    And i want it to increase by 100 for one person.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried to find solutions, but no luck.

Main (server) Code:

game.ReplicatedStorage.WriteCode.OnServerEvent:Connect(function(player)
	if player.other.linesremain.Value >= 1 then
		player.other.linesremain.Value = player.other.linesremain.Value - player.other.knowledge.Value
		if player.other.linesremain.Value < 1 then
			game.ReplicatedStorage.hidemaking:FireClient(player)
			wait()
		end
	end
end)

game.ReplicatedStorage.FinishedCoding.OnServerEvent:Connect(function(player)
	player.other.knowledge.Value = player.other.knowledge.Value + 1
	game.ReplicatedStorage.levelup:FireClient(player)
	player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 100
end)

Where’s the script where “FireServer()” is called on the RemoteEvent instance.

the script(s):

-- (writecode)
local button = script.Parent

button.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.WriteCode:FireServer()
end)

--(finishedcoding)
game.ReplicatedStorage.hidemaking.OnClientEvent:Connect(function()
	game.ReplicatedStorage.FinishedCoding:FireServer()
	script.Parent.Parent.Visible = false
end)

There should be no way for it to give +200 instead of +100 unless your remote, FinishedCoding, fires twice. Maybe you should try debugging by printing out values to see what goes wrong exactly. There’s nothing wrong with your code for it to do that by itself so I don’t think the problem is inside of one of these two scripts.

oh i found out what was causing the problem, just needed to add some waits, and change a few lines.