my script is
local Total = game:GetService("DataStoreService"):GetDataStore("Total")
function savedata(dataname, playerid, value)
game:GetService("DataStoreService"):GetDataStore(dataname):SetAsync(playerid, value)
end
game.Players.PlayerAdded:connect(function(player)
local swordfolder = Instance.new('Folder')
swordfolder.Name = 'Swords'
swordfolder.Parent = player
local Total = Instance.new('IntValue')
Total.Value = Total:GetAsync(tostring(player.userId))
Total.Parent = game.Players.LocalPlayer
Total.Name = 'TotalSwordValue'
Total.Changed:connect(function()
savedata("Total", player.userId, Total.Value)
end)
savedata("Total", player.userId, Total.Value)
end)
game.Players.PlayerRemoving:connect(function(player)
savedata("Total", player.userId, player.Total.Value)
end)
error in the title the line is 12

1 comment
thanks!