Help | Universal plr count

I’m having issue with my code, and I was wondering, I’m doing something wrong in my code.
I’m receiving an error at
local Server = ServerStore:GetAsync("ABC")[1]

local ServerStore = game:GetService("DataStoreService"):GetDataStore("Servers")

while true do 
	local Instancex = ""
	local Playersx = 0
	if ServerStore:GetAsync("ABC") == {} then
		game.ReplicatedStorage.TESTPLACE.ServerExists.Value = false
	end
	if ServerStore:GetAsync("ABC") ~= {} then
		local Server = ServerStore:GetAsync("ABC")[1]
		if Server then
			Playersx = Server[2]
			Instancex = Server[1]
			game.ReplicatedStorage.TESTPLACE.ServerExists.Value = true
		else
			game.ReplicatedStorage.TESTPLACE.ServerExists.Value = false
		end
	end
	game.ReplicatedStorage.TESTPLACE.Value = Playersx
	game.ReplicatedStorage.TESTPLACE.Instance.Value = Instancex
	if Playersx < 1 then
		game.ReplicatedStorage.TESTPLACE.ServerExists.Value = false
	end
	wait(2.5)
end
1 Like

What’s the error message saying?

ServerScriptService.Script:11: attempt to index nil with number

What did you expect it to do when the value is nil?
What’s checking == {} for?

hmm, good question lol. Idk, cuz I didn’t completely scripted this myself so yea.

I think you should use HTTP service, knowing that there are race conditions cross-server if that ever happened.

2 Likes