I am making a game where I need the player to view a cutscene the first time they enter. I am trying to use DataStores to store whether they viewed it or not. However, nothing I'm trying seems to be working. The wiki isn't clear to me and I can't figure out how to use this DataStore system. What would any of you suggest to help me overcome this issue and only play the cutscene when the player first joins.
✓ ANSWER ACCEPTED
How do I use DataStores upon entry of game?
1 answer
✓ Accepted answer
Something like this should work:
local hasJoinedStore = game:GetService("DataStoreService"):GetDataStore("HasJoined")
game.Players.PlayerAdded:Connect(function(plr)
local hasJoined = hasJoinedStore:GetAsync("plr_" .. plr.UserId)
if not hasJoined then
--do stuff if first time
hasJoinedStore:SetAsync("plr_" .. plr.UserId,true)
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
