Help with this script that only gives one player coins

Hello Community, I need your help on this Coin Script, and what happens is that if it serves me well, but the players do not serve them but only gives me the coins is me, what can I do?


local Players = game:GetService("Players")

local goldChunk = script.Parent

local function onPartTouch(otherPart)
	local partParent = otherPart.Parent
	local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
	if humanoid then
		-- Destroy the pickup
		-- Update the player's leaderboard stat
		local player = Players:GetPlayerFromCharacter(partParent)
		local leaderstats = player.leaderstats
		local Level = leaderstats and leaderstats:FindFirstChild("Level")
		if Level then
			Level.Value = Level.Value + 1 * player.Multiplier.Value

Destroying goldChunk destroys the script inside it aswell, making the rest of the code not execute. Use Debris or delete goldChunk at the end of method.

1 Like