amnt = 1
function onTouched(part)
	local h = part.Parent:findFirstChild("Humanoid")
	if (h~=nil) then
		local thisplr = game.Players:findFirstChild(h.Parent.Name)
		if (thisplr~=nil) then
			local stats = thisplr:findFirstChild("leaderstats")
			if (stats~=nil) then
				local score = stats:findFirstChild("Shiny Objects)")
				if (score~=nil) then
					score.Value = score.Value + amnt
				end
			end
		end
		script.Parent:remove()
	end
end

script.Parent.Touched:connect(onTouched)

That is my coin script

function onPlayerEntered(newPlayer)
	wait(.5)
	local stats = Instance.new("IntValue")
	stats.Name = "leaderstats"
	local weaponsBackpack = Instance.new("StringValue")
	weaponsBackpack.Name = "Weapons"


	local cash = Instance.new("IntValue")
	
	cash.Name = "Shiny Objects"
	cash.Value = 0

	cash.Parent = stats
	
	stats.Parent = newPlayer
	weaponsBackpack.Parent = newPlayer

end

game.Players.ChildAdded:connect(onPlayerEntered)

thats my leaderboard

4 comments

0

Btw im not good with LB so i used free scripts D:

0

So whats wrong with the script?

0

There is a ) inside of ("Shiny Objects)")

0

Thank you!