Coin is limited to singular player

  1. Hi, my intent is to make a coin system where a sole coin can be collected by every player on the server, but only once per player. I used a coin from the tool-box as a base and simply added a remote event to change the parts transparency on the client; it works as intended until a second player tries to pick up the same coin.

  2. https://gyazo.com/6187ea57bca5c38f2f8281427cf0ad4d

-- Script in workspace part

local db = true
script.Parent.Touched:connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") ~= nil then
		if db == true then
			db = false
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1
			script.Sound:Play()
			game.ReplicatedStorage.CoinVisibility:FireClient(player)
		end
	end	
end)
-- Local Script for part transparency

local player = game:GetService("Players").LocalPlayer

game.ReplicatedStorage.CoinVisibility.OnClientEvent:Connect(function(player)
	game.Workspace.Coin.Transparency = 1
end)

Try placing a coin collection local script inside starter character script where everytime the player’s root part touches the coin it will trigger a remote event inside the coin and when a server script receives this remote event, it will give the player a coin, add the player to a table and send a remote event back to the character script. When the character script receives the event, it will set the coin to transparent.

The server script will not give the player coin if the player is inside of the table.

Setting the db variable back to true resolved the issue.