-IM NOT GOOD IN EXPLAINING CUZ I SUCKS AT ENGLISH-
So I'm making a 1-player-only game and when the player joins, a local script will check if a BoolValue is true. If it's false (meaning that this is the first time the player has joined), another local script that will give welcome messages will be enabled and run. At the end of the same welcome local script, it will fire a RemoteEvent to the server to make the BoolValue's Value to true and then proceed to the next event and something unimportant...
This is the problem. When the player left, a DataStore will save that BoolValue's Value for the player but it still says false even after the server has changed the Value to true. Is the DataStore not saving at all? (Because I put a print() if the saving is a success but it doesn't appear in the Output)
Here's the DataStoreService Script with a bunch of print() (BaseScript):
local dts = game:GetService("DataStoreService")
local DTWelcome = dts:GetDataStore("dtwelcome")
game.Players.PlayerAdded:Connect(function(player)
local statement = player:WaitForChild("Statements")
local welcome = Instance.new("BoolValue")
welcome.Name = "Welcome"
welcome.Parent = player.Statements
local data
local success, errormessage = pcall(function()
data = DTWelcome:GetAsync("1-"..player.UserId)
end)
if success then
welcome.Value = data
print("(JOINED)"..player.Name.."'s Welcome Bool is ")
print(tostring(data))
else
print("ERROR001 - Something happened while getting data...")
warn(errormessage)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
print("(LEFT)"..player.Name.."'s Welcome Bool is currently ")
print(tostring(player.Statements.Welcome.Value))
local success, errormessage = pcall(function()
DTWelcome:SetAsync("1-"..player.UserId,player.Statements.Welcome.Value)
end)
if success then
print("Saved!")
warn(errormessage)
else
print("ERROR002 - Something happened while saving data...")
warn(errormessage)
end
end)
Here's a piece of the Welcome local script (At the end of the script):
changeBool:FireServer(player,"welcome",true)
This is what happens in the Output when you play the game tho:
(JOINED)Player's Welcome Bool is false
20:10:29.484 - ActivateCameraController did not select a module. (x2)
(LEFT)Player's Welcome Bool is currently false
20:11:02.438 - Disconnect from 127.0.0.1|60492
Had to put it into Code Block so the line break works.
EDIT: I doubled-checked if the BoolValue's Value has changed when the welcome messages are done. It seems to be not changed so there might be something to do with this block of code:
local rep = game:GetService('ReplicatedStorage')
local remoteevent = rep:WaitForChild("ChangeBool")
remoteevent.OnServerEvent:Connect(function(player,argument,bool)
if argument == "welcome" then
player.Statements.Welcome.Value = bool
end
end)

9 comments
Is this in studio?
It's in studio
Do you have "Access to API services" enabled?
Yes. If it's not enabled it will throw an error right?
Can I see the server logic of changeBool?
You need to give more info, or we can't help you.
Server logic as in the script for the remote event function when fired to server? Sorry for lack of info because I'm not really expert in these things...
Yes, I want to see what happens what the server does with the changeBool RemoteEvent.
I edited the question. I also point out that the BoolValue's Value doesn't change.