What do you want to achieve? Keep it simple and clear!
Saving Value of BoolValue in Data.
What is the issue? Include screenshots / videos if possible!
I tryed create BValue by Instance.new() in plr from datastore script, and save like that…
But value not saving(
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
…like that:
game.Players.PlayerRemoving:Connect(function(plr)
local success,err = pcall(function()
myData:SetAsync(plr.UserId,plr.leaderstats.Coins.Value)
myData:SetAsync(plr.UserId,plr.Gate1.Value) -- BOOLVALUE
end)
if err then
warn(err)
end
end)
A small snippet of how to save bool values in datastores:
local DataStoreServ = game:GetService("DataStoreService")
local dataStoreLibrary = DataStoreServ:GetDataStore("testData")
game.Players.PlayerRemoving:Connect(function(plr)
local success, errorM = pcall(function()
dataStoreLibrary:SetAsync("boolValue", true)
end)
if success then
print("yay saved")
elseif errorM then
print("errorlol")
end
end)
yes, i know, i replace that, but when i save value i’ve get that issue
ServerScriptService.DataStoreScript:43: attempt to call missing method 'SetAsync' of table
code:
game.Players.PlayerRemoving:Connect(function(plr)
print("VALUE IS ",plr.Gate1.Value)
local success,err = pcall(function()
myData:SetAsync(plr.UserId,plr.leaderstats.Coins.Value)
GateData:SetAsync(plr.UserId,{plr.Gate1.Value})
end)
if err then
warn(err)
end
end)