Need help making intel ui when player hovers mouse over another player

Ok, so i mtrying to script a system when the player hovers there mouse over another player it displays info about them.

this is my code:

--[ VARIABLES ]--
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

local GroupID = 12024357

--[ SERVICES ]--
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

--[ MAIN ]--
while true do
	RunService.Heartbeat:Wait()
	pcall(function()
		if Mouse.Target ~= nil then
			if Mouse.Target.Parent:FindFirstChild("Humanoid") then
				local TargetPlayer = game.Players:GetPlayerFromCharacter(Mouse.Target.Parent)

				local Frame = Player.PlayerGui.MouseHoverIntel.Frame
				Player.PlayerGui.MouseHoverIntel.Enabled = true

				local Pos = UserInputService:GetMouseLocation()
				Frame.Position = UDim2.new(0, Pos.X, 0, Pos.Y - 36)
				
				local String1 = TargetPlayer.Name
				local String2 = TargetPlayer.Team
				local String3 = TargetPlayer:GetRoleInGroup(GroupID)
				local StringSplit = " | "
				
				local MainString = String1..StringSplit..String2..StringSplit..String3
				
				Frame.TextLabel.Text = MainString
			else
				Player.PlayerGui.MouseHoverIntel.Enabled = false
			end
		end
	end)
end

Currently everything works but it wont change the text no matter what i do, please help.

For String2, do TargetPlayer.Team.Name, as you are grabbing a object instead of a string.

The code is erroring and because of pcall you couldn’t see the cause of it.

Thank you, i was here for 10 minutes before i made the post trying to figure out what I was doing wrong

1 Like