Firing multiple times to the server

Hey, do you guys know why it fires multiple times to the server? I tried to use debounce like someone told me but it still not working correctly. When I test the game alone and collect all the parts it works and the value is correct but when I play test with more than 1 people when I collect a part it adds more than just 1 , for example it could add like 6 on the value if u collect just one part. Any ideas on why this might be happening?

local milktext = gui:WaitForChild("MilkCountFrame"):WaitForChild("MilkAmount")
local dialogue = gui:WaitForChild("DialogueFrame")

local currentmilk = game:GetService("ReplicatedStorage"):WaitForChild("CurrentMilk")

local totalmilk = 0

local debounce = false

for _,Part in ipairs(workspace.GameMilks:GetChildren()) do
      if Part:IsA("BasePart") then
        Part.Touched:Connect(function(Hit)
			if not debounce then
				debounce = true
                Part:Destroy()
				print("u got the milk")
				totalmilk += 1
				milktext.Text = totalmilk
				dialogue.Visible = true
				dialogue:WaitForChild("TextLabel").Text = "A milk has been obtained."
				task.wait(1)
				dialogue.Visible = false
				currentmilk:FireServer(Hit)
			end
			debounce = false
       	end)
    end
end

This is due to the fact that LocalScripts are directed towards the players client. What this means is, this code will run for every individual player. Therefore, this code will run x number of times for each client, and then it will also fire x number of times to the server because ALL clients are tracking that Touched event.

Personally, I’d recommend moving this code to the server inside of the ServerScriptService. Not only should it eliminate your issue, it’ll also get rid of a remote event, and get rid of any potential possibilities of malicious users attempting to use that event to lag your game.

Let me know how it turns out!