for context: i'm new to Lua and i'm doing this weird thing where i have a normal leaderboard and that leaderboard shows how many bricks you and other people have made (i also made a global leaderboard of everyones scores but imma mess with that later)
the script that i'm using for the leaderboard is:
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("BrickCountSaveSystem")
game.Players.PlayerAdded:connect(function(plr)
local folder = Instance.new("Folder", plr)
folder.Name = "leaderstats"
local BrickCount = Instance.new("IntValue", folder)
BrickCount.Name = "Bricks"
BrickCount.Value = ds1:GetAsync(plr.UserId) or 0
ds1:SetAsync(plr.UserId, BrickCount.Value)
BrickCount.Changed:connect(function()
ds1:SetAsync(plr.UserId, BrickCount.Value)
end)
end)
the script that makes the both "react' is:
local part = game.Players.leaderstats
BrickCount = 0
game.Players.player.leaderstats.Bricks = BrickCount
function onClicked()
BrickCount = BrickCount+1
game.Players.player.leaderstats.Bricks = BrickCount
end
script.Parent.ClickDetector.MouseClick:Connect(onClicked)
i know that i've messed up the Players.leaderstats part, but idk how to dig out the leaderboard stats any other way, my brain too small but i'm betting i'll have to GetService my way into the leaderstats folder
what i'm trying to get is the brick value to increase by 1 with every click, so 1 button press = +1 Bricks, and so on
