Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i get to save a BoolValues Value?

trying to make a save system but the value wont save.

saving script:

local datastore = game:GetService("DataStoreService")
local seatside = datastore:GetDataStore("seatside1")

script.Parent.OnServerEvent:Connect(function(player,
	seatsided

	)
if seatsided.Value == true then
	seatside:SetAsync(player.UserId,true)
elseif seatsided.Value == false then
	seatside:SetAsync(player.UserId,false)
end

load script:

local datastore = game:GetService("DataStoreService")
local seatside = datastore:GetDataStore("seatside1")


local player = script.Parent.player.Value

	wait(0.1)	
	
	script.Parent.Parent:WaitForChild(player.Name.."Data").Slot1.cosmetics.RHD.Value = seatside:GetAsync(player.UserId) or false

thxyes

1 answer

It doesnt save the value because it is nowhere mentioned in seatside:SetAsync. Maybe this script will help you:

Script:

	    seatside:SetAsync(player.UserId.."seatsided", seatsided.Value)

LocalScript:

script.Parent.Parent:WaitForChild(player.Name.."Data").Slot1.cosmetics.RHD.Value = seatside:GetAsync(player.UserId.."seatsided") or false

I added player.UserId.."seatsided", because its better you give it another name, it does not get very confusing then if you save something else.

If something is wrong, write a comment under this and I will take a look at it.

3 comments

0

i have tried added seatsided.value, yet it still wont save

0

Can you print the variable that is supposed to get saved? Id like to know what it prints.

0

prints out true

This discussion is preserved as it was. New answers, comments, and votes are closed.