Gameid value is nil

I’m probably being super dumb right now, but I can’t figure out how to handle this error:
Workspace.MrSprinkleToes.LocalScript:14: bad argument #3 to 'Value' (string expected, got nil)

This is the code in the script that provides that error:

local friends = game:GetService("Players").LocalPlayer:GetFriendsOnline()
local plr = game:GetService("Players").LocalPlayer
local amm = 0

for _,v in pairs(friends) do
	amm = amm + 1
	local friend = plr.PlayerGui.friend:Clone()
	friend.Name = v.UserName
	friend.avatar.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username="..v.UserName
	if v.LastLocation == "Online" then
		friend.statusonline.Visible = true
	else
		friend.statusingame.Visible = true
		friend.gameid.Value = v.PlaceId
	end
	friend.status.Value = v.LastLocation
	friend.Parent = plr.PlayerGui.ScreenGui.friends
end

if amm == 0 then
	plr.PlayerGui.ScreenGui.sad.Visible = true
end

while wait(5) do
	local friends = game:GetService("Players").LocalPlayer:GetFriendsOnline()
	for _,v in pairs(plr.PlayerGui.ScreenGui.friends:GetChildren()) do
		if v.Name ~= "UIGridLayout" then
			v:Destroy()
		end
	end
	for _,v in pairs(friends) do
		local friend = plr.PlayerGui.friend:Clone()
		friend.Name = v.UserName
		friend.avatar.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username="..v.UserName
		if v.LastLocation == "Online" then
			friend.statusonline.Visible = true
		else
			friend.statusingame.Visible = true
			friend.gameid.Value = v.PlaceId
		end
		friend.status.Value = v.LastLocation
		friend.Parent = plr.PlayerGui.ScreenGui.friends
	end
end
2 Likes

I fixed it in a way that may not be recommended, probably not recommended, but I just forced whatever v.PlaceId was to be a string.
tostring(v.PlaceId)

1 Like

You should just make friend.gameid an IntValue

1 Like

oh my gosh your right how didn’t I think of that?? that does work, ill be doing that instead of my fix

1 Like