you know how the leader board thing in the top right hand corner I want a variable called winner and in a separate script i have add 1 "point" to the leader board when part clicked.

local para = true
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("MoneySaveSystem")

game.Players.PlayerAdded:connect(function(player)
	local leader = Instance.new("Folder",player)
	leader.Name = "leaderstats"
	local Para = Instance.new("IntValue",leader)
	Para.Name = "Winner"
	Para.Value = ds:GetAsync(player.UserId) or 0
	Para.Changed:connect(function()
		ds:SetAsync(player.UserId, Para.Value)
		
	end)
end)

game.Players.PlayerRemoving:connect(function(player)
	ds:SetAsync(player.UserId, player.leaderstats.Cash.Value)
end)

then in the other script

function onClicked(part)
	para.Value = para.Value + 1		
end

can you tell me what's wrong and how I fix it please. BTW this script should save but I cannot test it so I don't know does it look alright and where do i put the scripts. I am new to scripting.

4 comments

1

A global leaderboard or a playerlist?

1

The script should basicly save the leaderboard stats if the "Para" change?

0

@SurfyStefanos a global leader board but only shows players who have 1 point or more

0

@GalaxycraftTV what do you mean? i am not very good with scripts.