Can't Get UserID

Hi there Other Developers,

I’ve been running into this issue where I can’t get the playerID of another player in the server,
here is my code:

DetailsFrame:WaitForChild("ApplyButton").Activated:Connect(function()
	if ReasonTextBox and DetailsFrame:WaitForChild("PlayerTextBox") ~= "" then
		local PlayerSelected = game.Players:FindFirstChild(DetailsFrame.PlayerTextBox.Text)

		if PlayerSelected ~= nil then
		AdminStorage.Events.AdminCMDEvent:FireServer(
             CommandType, ReasonTextBox.Text, PlayerSelected.UserID --// Here is the bug)
		end) 
	end
end)	

And the error in the output:
image

Thanks a lot!

It’s called .UserId

Code:

DetailsFrame:WaitForChild("ApplyButton").Activated:Connect(function()
	if ReasonTextBox and DetailsFrame:WaitForChild("PlayerTextBox") ~= "" then
		local PlayerSelected = game.Players:FindFirstChild(DetailsFrame.PlayerTextBox.Text)

		if PlayerSelected then
			AdminStorage.Events.AdminCMDEvent:FireServer(CommandType, ReasonTextBox.Text, PlayerSelected.UserId)
		end) 
	end
end)
1 Like