i tried making my script into a data store but then it says on line 50 '<eof>' expected near 'end'
how do i fix this?
local data = game:GetService("DataStoreService")
local mineminemine = data:GetDataStore("mineminemine")
game.Players.PlayerAdded:Connect(function(player)
local stats = Instance.new("Folder",player)
stats.Name = "leaderstats"
local cash = Instance.new("IntValue",stats)
cash.Name = "Cash"
cash.Value = 10
local gold = Instance.new("IntValue",stats)
gold.Name = "Gold"
gold.Value = 0
local data
local succes, errormessage = pcall(function()
data = mineminemine:SetAsync(player.UserId.."-cash")
end)
if succes then
cash.Value = data
else
print("aww not loaded")
warn(errormessage)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local succes, errormessage = pcall(function()
mineminemine:SetAsync(player.UserId.."-cash",player.leaderstats.Cash.Value and player.leaderstats.Gold.Value)
end)
if succes then
print("YES")
else
print("aww not save")
warn(errormessage)
end
end)
cash.Changed:Connect(function()
if player.leaderstats.Cash.Value >= 10000 then
player.leaderstats.Cash.Value = 0 -- Set the value = 0
player.leaderstats.Gold.Value = player.leaderstats.Gold.Value + 1
end
end)
end)

6 comments
maybe becuase there is two ends?
i will try
nope
hi see my answer
Extra end on line 28
means end of file (or in this case, your script)