Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

" Players:GetNameFromUserId() failed because HTTP 404 (NotFound)"?

Sorry for long script

local DataStoreService = game:GetService("DataStoreService")
local Score = DataStoreService:GetOrderedDataStore("Score")

local function update()
	local success, errormessage = pcall(function()
		local Data = Score:GetSortedAsync(false, 10)
		local ScorePage = Data:GetCurrentPage()
		for Rank, data in ipairs(ScorePage) do
			local Username = game.Players:GetNameFromUserIdAsync(tonumber(data.key))
			local Name = Username
			local wins = data.Value

	
			local isOnLeaderboard = false
		for i, v in pairs(game.Workspace.GlobalLeaderboard.Leaderboard.Holder:GetChildren())do
			if v.Player.Text == Name then
				isOnLeaderboard = true
				break
			end
		end
		
		if wins and isOnLeaderboard == false and wins >= 0 then
				local newframe = game.ReplicatedStorage:WaitForChild("LeaderboardFrame"):Clone()
			newframe.Player.Text = Name
			newframe.Score.Text = wins
			newframe.Rank.Text = "#"..Rank
			newframe.Position = UDim2.new(0,0, newframe.Position.Y.Scale + (.1 * #game.Workspace.GlobalLeaderboard.Leaderboard.Holder:GetChildren()),0)
			newframe.Parent = game.Workspace.GlobalLeaderboard.Leaderboard.Holder
			if Rank == 1 then 
				newframe.Player.TextColor3 = Color3.fromRGB(212, 175, 55)
				newframe.Score.TextColor3 = Color3.fromRGB(212, 175, 55)
				newframe.Rank.TextColor3 = Color3.fromRGB(212, 175, 55)
				game.Workspace.Displayos.TingFirst.SurfaceGui.Display.TextLabel.Text = Name
				elseif Rank == 2 then
				newframe.Player.TextColor3 = Color3.fromRGB(192,192,192)
				newframe.Score.TextColor3 = Color3.fromRGB(192,192,192)
				newframe.Rank.TextColor3 = Color3.fromRGB(192,192,192)
				game.Workspace.Displayos.TingSecond.SurfaceGui.Display.TextLabel.Text = Name
				elseif Rank == 3 then
				newframe.Player.TextColor3 = Color3.fromRGB(176,141,87)
				newframe.Score.TextColor3 = Color3.fromRGB(176,141,87)
				newframe.Rank.TextColor3 = Color3.fromRGB(176,141,87)
				game.Workspace.Displayos.TingThird.SurfaceGui.Display.TextLabel.Text = Name
				elseif Rank == 4 then
				game.Workspace.Displayos.TingForth.SurfaceGui.Display.TextLabel.Text = Name
				elseif Rank == 5 then
				game.Workspace.Displayos.TingFifth.SurfaceGui.Display.TextLabel.Text = Name
				elseif Rank == 6 then
				game.Workspace.Displayos.TingSixth.SurfaceGui.Display.TextLabel.Text = Name
				elseif Rank == 7 then
				game.Workspace.Displayos.TingSeventh.SurfaceGui.Display.TextLabel.Text = Name
				elseif Rank == 8 then
				game.Workspace.Displayos.TingEight.SurfaceGui.Display.TextLabel.Text = Name
				elseif Rank == 9 then
				game.Workspace.Displayos.TingNinth.SurfaceGui.Display.TextLabel.Text = Name
				else
					newframe.Player.TextColor3 = Color3.fromRGB(255, 255, 255)
				newframe.Player.TextColor3 = Color3.fromRGB(255, 255, 255)
				newframe.Player.TextColor3 = Color3.fromRGB(255, 255, 255)
			end
			
			end
		end
	end)
	if not success then
		print (errormessage)
	end
end
	while true do 
	for	_, player in pairs(game.Players:GetPlayers()) do
			Score:SetAsync(player.UserId, player.leaderstats.Score.Value)
		end
	for _, frame in pairs(game.Workspace.GlobalLeaderboard.Leaderboard.Holder:GetChildren())do
		frame:Destroy()
	end
update()
	print ("Update")

	wait(59.7)
	end

-- newframe.Player.BackgroundColor3 = Color3.fromRGB(0,0,0)

3 answers

You probably haven't enabled the ability for Roblox Studio to have access to Https services

2 comments

0

You could go to the Game settings in the home page in studio, and then turn on HttpsServices

0

Ive had this on throughout

It is probably because you're trying to find a player that either A. Doesn't exist, B. Is banned, or C. You put in an invalid ID.

This is probably a problem with your Internet, router or computer. I suggest you try it again or check your router. Otherwise, I don't know.

2 comments

0

Doenst work in a server either.

0

I think you should check into @KBRM101's answer

This discussion is preserved as it was. New answers, comments, and votes are closed.