Any Fixes For Argument 1 missing or nil in my Roblox Story game?

Here is the Code That has the Argument

local content, isReady = game:GetService("Players"):GetUserThumbnailAsync(player_id, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)

Incase you need to know my code this is my Whole code

local CreateDialogueEvent = game.ReplicatedStorage.CreateDialogueEvent
local TransitionEvent = game.ReplicatedStorage.TransitionEvent
-- Other Useful Functions

local randomPlayerName
local randomPlayerId

local function getPlayerImage(player_id)
	local content, isReady = game:GetService("Players"):GetUserThumbnailAsync(player_id, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
	return content
end

local function getRandomPlayer()
	local players = game.Players:getPlayers()
	local number = math.random(1,#players)
	local randomPlayer = players[number]
	randomPlayerName = randomPlayer.Name
	randomPlayerId = randomPlayer.UserId
end
local function getRandomPlayer()
	local players = game.Players:getPlayers()
	local number = math.random(1,#players)
	local randomPlayer = players[number]
	randomPlayerName = randomPlayer.Name
	randomPlayerId = randomPlayer.UserId
end

function teleportPlayers(partCFrame)
	local players = game.Players:getPlayers()
	for _,player in pairs(players) do
		if player.Character then
			if player.Character.HumanoidRootPart.Anchored == false then
				player.Character.Humanoid.Jump = true
			end
		end
	end
	wait(.5)
	for _,player in pairs(players) do
		if player.Character then
			if player.Character.HumanoidRootPart.Anchored == false then
				player.Character:SetPrimaryPartCFrame(partCFrame)
			end
		end
	end
end
----------------------------------------

-- put your challenge functions here

local function challeng_example() -- THIS IS JUST AN EXAMPLE! IT WON'T RUN
	local teacher_Image = "rbxassetid://4955860828"
	CreateDialogueEvent:FireAllClients(teacher_Image,"Hello Students!")
	wait(5)
	getRandomPlayer()
	CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId),"I think this is the School!")
end

local function challenge_intro()
	local Police_image = "rbxassetid://4955860828"
	CreateDialogueEvent:FireAllClients(Police_image,"Please Wait as The Players Load!")
	wait(7)
	CreateDialogueEvent:FireAllClients(Police_image,"Look Around For Cool Stuff")
	wait(6)
	CreateDialogueEvent:FireAllClients(Police_image,"Also Can AnyBody Find my Key to the House?")
	wait(5)
	local key = game.ReplicatedStorage.DoorKey:Clone()
	key.Parent = game.Workspace
	repeat wait() until game.Workspace:FindFirstChild("DoorKey") == nil 
	CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId),"We Found The Key!")
	wait(5)
	TransitionEvent:FireAllClients()
	wait(3)
	teleportPlayers(game.Workspace.TeleportHouse.CFrame)

	
end

local function challenge_1()
	local Police_image = "rbxassetid://4955860828"
	getRandomPlayer()
	CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId),"Why Can't We go to the SHOPS!")
	wait(5)
	CreateDialogueEvent:FireAllClients(Police_image,"Because we are in Quaratine we need to stay safe!")
	wait(4)
	getRandomPlayer()
	CreateDialogueEvent:FireAllClients(getPlayerImage(randomPlayerId),"Im so bored... I WANNA GO TO THE CITY")
	wait(6)
	CreateDialogueEvent:FireAllClients(Police_image,"Don't Worry We are gonna have lots of fun in quaratine!")
	
end

local function challenge_2()
	
end

local function challenge_3()
	
end

local function challenge_4()
	
end

local function challenge_ending()
	
end

--------------------------------------------------

local function startGame() -- This is your main function where we order the challenges
	challenge_intro()
	challenge_1()
	challenge_2()
	challenge_3()
	challenge_4()
	challenge_ending()
end

wait(10) -- waits 10 seconds
startGame() -- runs the startGame function

Here is my Output

  16:53:36.573 - Argument 1 missing or nil
16:53:36.574 - Stack Begin
16:53:36.574 - Script 'ServerScriptService.GameScript', Line 9 - function getPlayerImage
16:53:36.574 - Script 'ServerScriptService.GameScript', Line 69 - function challenge_intro
16:53:36.575 - Script 'ServerScriptService.GameScript', Line 111 - function startGame
16:53:36.575 - Script 'ServerScriptService.GameScript', Line 120
16:53:36.575 - Stack End

Any Fixes it Would be Really Helpful!!!

3 comments

0

The part where it says game:GetService("Players"):GetUserThumbnailAsync(player_id, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420) has to be changed to a nil.Value and the transparency of the local gui needs to be set to 16. Also use WaitForChild so that you don't have to call a FindFirstChild event, that prevents the players from Enum.ThumbnailType.Headshot to be non existant

0

How should i set the transparency to 16?

0

randomPlayerId is nil when you call the function. You need to assign it a value