local function onPlayerEnter(player) -- use local functions
local ls = Instance.new("Configuration")
ls.Name = "leaderstats"
ls.Parent = player
local points = Instance.new("IntValue")
points.Name = "Points"
points.Value = 0
points.Parent = ls
while true do
points.Value = points.Value + 1
wait(1)
end
end
game:GetService("Players").PlayerAdded:Connect(onPlayerEnter)
So I have this leaderboard script which adds a point every second.
script.Parent.Text = tostring(script.Parent.ItemName.Value)..": "..tonumber(script.Parent.Cost.Value).." "..tostring(script.Parent.Currency.Value)
script.Parent.MouseButton1Click:connect(function()
if script.Parent.Parent.Parent.Parent.Parent.Parent:findFirstChild("leaderstats") then
if script.Parent.Parent.Parent.Parent.Parent.Parent.leaderstats[script.Parent.Currency.Value].Value >= tonumber(script.Parent.Cost.Value) then
script.Parent.Parent.Parent.Parent.Parent.Parent.leaderstats[script.Parent.Currency.Value].Value = script.Parent.Parent.Parent.Parent.Parent.Parent.leaderstats[script.Parent.Currency.Value].Value - tonumber(script.Parent.Cost.Value)
game.ReplicatedStorage[script.Parent.ItemName.Value]:Clone().Parent = script.Parent.Parent.Parent.Parent.Parent.Parent.Backpack
game.ReplicatedStorage[script.Parent.ItemName.Value]:Clone().Parent = script.Parent.Parent.Parent.Parent.Parent.Parent.StarterGear
end
end
end)
I also have this market script which subtracts the cost of the item from the amount of points the player has. However, the problem is that when the player buys the item the amount of points the player has is correct, however once another point is added the amount of points the player has is reverted back to the amount of points the player had before the transaction.
tldr;
when a noob buys a thing the points are first correct then are reverted back to how they were b4 the noob bought the thing

3 comments
What are all of those .Parent for?
Bro, learn to use variables
The script is in a gui in the playergui so im just using those to get to the leaderboard point value.