This is my datastore script that checks if a player has played the game before (I'll add more later) but I get a weird error: SetAsync is not a valid member of RemoteEvent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Save = ReplicatedStorage:WaitForChild("Save")
game.Players.PlayerAdded:connect(function(player)
local PlayerStats = Instance.new("Folder", player)
PlayerStats.Name = "PlayerStats"
local HasJoinedBefore = Instance.new("BoolValue", PlayerStats)
HasJoinedBefore.Name = "HasJoinedBefore"
HasJoinedBefore.Value = Save:GetAsync(player.UserId) or false
Save:SetAsync(player.UserId, HasJoinedBefore.Value)
HasJoinedBefore.Changed:connect(function()
Save:SetAsync(player.UserId, HasJoinedBefore.Value)
end)
end)
game.Players.PlayerRemoving:connect(function(player)
Save:SetAsync(player.UserId, player.PlayerStats.HasJoinedBefore.Value)
end)
local function save(player)
player.PlayerStats.HasJoinedBefore.Value = true
Save:SetAsync(player.UserId, player.PlayerStats.HasJoinedBefore.Value)
end
Save.OnServerEvent:Connect(save)

2 comments
Your save variable leads to a remote event, not the datastore.
how can I fix that?