Hello, can someone help me with getting Offline player’s Bool value (with datastore)?
What do you want to achieve?
I want to get the offline players bool value and if its true it will do something. Basicly I want to get a True/False word from the offline player.
What is the issue?
I have no clue how to solve this.
local DataStore = game:GetService("DataStoreService"):GetDataStore("DataStore")
local Leaderstats = Instance.new("Folder")
Leaderstats.Name = "leaderstats"
Leaderstats.Parent = Player
local IsVip = Instance.new("BoolValue")
IsVip.Name = "IsVip"
IsVip.Parent = Leaderstats
local Success, ErrorMessage = pcall(function()
IsVipData = DataStore:GetAsync(Player.UserId.."-IsVipData")
--------Now tricky part comes:
-- offline player is called "DavidLolHun"
local Name = "DavidLolHun"
if DavidLolHun.leaderstats.IsVip.Value == true then
print("Offline player named DavidLolHun is Vip")
print("Offline player named DavidLolHun is NOT Vip")
You already have your answer with the code you provided. Take a look at this:
What you’re doing here essentially is whenever a player joins, you’re looking to see if that specfic datastore is true or false. This is exactly what you need to do to get the information, with a few changes.
Because you’re looking for a username, you need to convert that to a userId. This can be done with Players:GetUserIdFromNameAsync. Then, simply feed that value into a function similar to your PlayerAdded. If you’re confused on anything let me know and I’ll try and provide a sample, however that should work fine.