Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to program an item to add a score to leaderboard?

Asked by 5 years ago
Edited by User#24403 5 years ago

(TL:DR i made a leaderboard but i cant get a item to add 1+ to weight.) i am new to roblox studio and i have made a leaderboard script:

```lua local datastore = game:GetService("DataStoreService")

local ds1 = datastore:GetDataStore("GemSaveSystem")

local ds2 = datastore:GetDataStore("WeightSaveSystem")

game.Players.PlayerAdded:Connect(function(plr)

local folder = Instance.new("Folder", plr)

folder.Name = "leaderstats"

local gems =Instance.new("IntValue", folder)

gems.Name = "Gems"

local weight = Instance.new("IntValue", folder)

weight.Name = "Weight"

gems.Value = ds1:GetAsync(plr.UserId) or 0

ds1:SetAsync(plr.UserId, gems.Value)

weight.Value = ds2:GetAsync(plr.UserId) or 0

ds2:SetAsync(plr.UserId, weight.Value)

gems.Changed:connnect(function()

ds1:SetAsync(plr.UserId, gems.Value)

end)

weight.Changed:connect(function()

ds2:SetAsync(plr.UserId, weight.Value)

end)

end) ``` But i cant get a item to add 1+ to weight.Value, and cant get it to detect a click.

0
regular script, for click detector use MouseClick or use magnitude from pos to other pos. to increment something use weight.Value = weight.Value + 1 from regular script greatneil80 2647 — 5y
0
Is it like a gear u want to add weight or a button? spot6003 64 — 5y

Answer this question