UserId does not seem to be working

Hello! I’m having trouble with getting the player’s UserId…It seems like it won’t pass whenever I change the card’s name in Trello to UserId. Although it works when I change the script to Player.Name and the Trello card’s name to the players user. I’d appreciate the help. Thank you!

local JanitorBlocker = game.workspace:WaitForChild("JanitorBlocker") -- this is the part that blocks the player from the janitor area
local RE = game:GetService("ReplicatedStorage"):WaitForChild("JanitorRoomClient")

JanitorBlocker.CanCollide = true

local TrelloEvent = game.ReplicatedStorage:WaitForChild("TrelloEvent")
local TrelloAPI = require(game.ServerScriptService:WaitForChild("TrelloAPI"))
local BoardID = TrelloAPI.BoardsAPI.GetBoardID("Sector Leads")
local ListId = TrelloAPI.BoardsAPI.GetListID(BoardID,"🧹 Dirty Janitors")


game.Players.PlayerAdded:Connect(function(Player)
	for _, JanitorNames in pairs(TrelloAPI.CardsAPI.GetCardsOnList(ListId)) do
		if JanitorNames.name == Player.UserId then
			RE:FireClient(Player)
		end
	end
end)

it might be just tostring(Player.UserId)

I agree with @sinanxd2 , the issue may be that the Trello “name” is a string that contains the UserId, meanwhile Player.UserId is actually handled as a number by the script.
So, as sinanxd2 already suggested, replacing the UserId comparison line with this one should do the trick:

if JanitorNames.name == tostring(Player.UserId) then
1 Like

Thank you so much! I will mark your answer as solution due to the explaination. Thank you @sinanxd2 for the original answer, this helped a lot!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.