I found some YouTube tutorial on how to make a selling brick for a sim game, it works on converting point to cash, but then just resets at like 51 when it was at 130,480 or something and if i sell a point again it goes up 10 and then goes back down 10
local Part = script.Parent
Part.Touched:Connect(function(HIT)
local H = HIT.Parent:FindFirstChild("Humanoid")
if H then
local player = game.Players:GetPlayerFromCharacter(HIT.Parent)
if player then
local leaderstats = player:WaitForChild("leaderstats")
local Currency = leaderstats.Coins
local Selling = leaderstats.Changes
if Selling.Value > 0 then
Currency.Value = Currency.Value + Selling.Value*10
Selling.Value = 0
script.Parent.clink:Play()
end
end
end
end)
Theres no errors to tell me whats wrong also heres the leaderstats just in case
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("officialpointfortlolSaveSystem")
local ds2 = datastore:GetDataStore("changetheimagecoinsSaveSystem")
local ds3 = datastore:GetDataStore("ctirebirthsSaveSystem")
local gamepass_id1 = 18287787
local gamepass_id2 = 18287797
local gamepass_id3 = 18309443
local stat = "Changes"
local gamepass_stat1 = 100
local gamepass_stat2 = 1000
local gamepass_stat3 = 10000
game.Players.PlayerAdded:connect(function(plr)
local folder = Instance.new("Folder", plr)
folder.Name = "leaderstats"
local gems = Instance.new("IntValue", folder)
gems.Name = "Changes"
local coins = Instance.new("IntValue", folder)
coins.Name = "Coins"
local rebirths = Instance.new("IntValue", folder)
rebirths.Name = "Rebirths"
gems.Value = ds1:GetAsync(plr.UserId) or 0
ds1:SetAsync(plr.UserId, gems.Value)
gems.Changed:connect(function()
ds1:SetAsync(plr.UserId, gems.Value)
coins.Value = ds2:GetAsync(plr.UserId) or 0
ds2:SetAsync(plr.UserId, coins.Value)
coins.Changed:connect(function()
ds2:SetAsync(plr.UserId, coins.Value)
rebirths.Value = ds3:GetAsync(plr.UserId) or 0
ds3:SetAsync(plr.UserId, rebirths.Value)
rebirths.Changed:connect(function()
ds3:SetAsync(plr.UserId, rebirths.Value)
local award3 = Instance.new("BoolValue", plr)
award3.Name = "Award3"
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, gamepass_id3) and plr.Award3.Value == false then
plr.Award3.Value = true
gems.Value = gems.Value + gamepass_stat3
end
end)
end)
while wait(3) do
for i, v in pairs(game.Players:GetChildren()) do
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(v.UserId, gamepass_id3) and v:WaitForChild("Award3").Value == false then
v.Award3.Value = true
v.leaderstats:FindFirstChild(stat).Value = v.leaderstats:FindFirstChild(stat).Value + gamepass_stat3
end
end
end
game.ReplicatedStorage.re.OnServerEvent:Connect(
function(player)
player.leaderstats.Changes.Value += 1
end)
end)
end)
