How to getdatastore while in legacy instead of servers

hello I want to make a leaderboard that are named with roles, and I can change the leaderbord through the gui and the only way I could think it would work is using datastore

this is the script I tried

local owners = game.ReplicatedStorage.Owners
local securityid = owners.Securityid
local groundcrewid = owners.GroundCrewid
local pilotid = owners.GroundCrewid
local workerid = owners.Workerid
local attendentworker = owners.AttendentWorker
local ownerid = owners.Owners



local DataStoreService = game:GetService("DataStoreService")

local Ownerr = DataStoreService:GetDataStore("Owner")
local GroundCrew = DataStoreService:GetDataStore("GroundCrew")
local ATC = DataStoreService:GetDataStore("ATC")
local FlightAttendent = DataStoreService:GetDataStore("FlightAttendent")
local Officer = DataStoreService:GetDataStore("Officer")
local Captain = DataStoreService:GetDataStore("Captain")
local Manager = DataStoreService:GetDataStore("Manager")
local Securitys = DataStoreService:GetDataStore("Security")


local function onPlayerJoin(player)
	print("Player Added: "..player.Name.." | "..player.UserId)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player
	local Owner = Instance.new("StringValue")
	Owner.Name = "Team"
	local plrid = tostring(player.UserId)
	Owner.Parent = leaderstats
	print("owner data: "..Ownerr:GetAsync(player.UserId))
	if plrid ~= "" then
		if string.find(ownerid.Value, plrid) or Ownerr:GetAsync(player.UserId) then
			Owner.Value = "Owner"
		elseif string.find(securityid.Value, plrid) or Securitys:GetAsync(player.UserId) then
			Owner.Value = "Security"
		else
			Owner.Value = "Guest"
		end
	end
		
		
	
end

game.Players.PlayerAdded:Connect(onPlayerJoin)
2 Likes