(sorry if i had a bad english)
So i tried to make a "userdata" the money work fine but the ban no
Script :
local V = script.Parent.Value
local Save = true
if V == true then
local DS = game:GetService("DataStoreService")
local Data = DS:GetDataStore("UserData")
game.Players.PlayerAdded:connect(function(P)
local UserData = Instance.new("Folder", P)
UserData.Name = "UserData"
local Leader = Instance.new("Folder", P)
Leader.Name = "leaderstats"
local Money = Instance.new("IntValue", Leader)
Money.Name = "Money"
if Save == true then
Money.Value = Data:GetAsync(P.UserId) or 25
else
Money.Value = 25
end
local Banned = Instance.new("BoolValue", UserData)
Banned.Name = "Banned"
Banned.Value = Data:GetAsync(P.UserId) or false
if Banned.Value = true then
P:Kick()
end
Data:SetAsync(P.UserId, Money.Value, Banned)
Money.Changed:connect(function()
Data:SetAsync(P.UserId, Money.Value)
end)
Banned.Changed:connect(function()
Data:SetAsync(P.UserId, Banned.Value)
end)
end)
game.Players.PlayerRemoving:connect(function(P)
Data:SetAsync(P.UserId, P.leaderstats.Money.Value , P.UserData.Banned)
end)
end
