In the script below I need to check for the other persons rank. I have a hover over GUI that shows one person the others rank. Here is the code:
local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse() mouse.Move:Connect(function() script.Parent.Position = UDim2.new(0, mouse.X + 10, 0, mouse.Y + 5) script.Parent.Visible = false local target = mouse.Target if target and target.Parent then if target.Parent:FindFirstChild("HumanoidRootPart") then script.Parent.Text = target.Parent.Name script.Parent.Visible = true end if target:FindFirstChild("Mouseover") then script.Parent.Text = target.Mouseover.Value script.Parent.Visible = true end end end)
It would be very helpful to be told what I should do to show the persons group rank.
I am assuming script.Parent is a TextLabel. You should also consider using UserInputService rather than Mouse, as is it not recommended for new work and UserInputService is more flexible.
local player = game:GetService("Players").LocalPlayer local mouse = player:GetMouse() local groupid = () -- put the id of your group in the parentheses mouse.Move:Connect(function() script.Parent.Position = UDim2.new(0, mouse.X + 10, 0, mouse.Y + 5) script.Parent.Visible = false local target = mouse.Target if target and target.Parent then if target.Parent:FindFirstChild("HumanoidRootPart") then script.Parent.Text = target.Parent.Name script.Parent.Visible = true tplayer = target.Parent:GetPlayerFromCharacter(tplayer) -- gets the player from the char if tplayer:IsInGroup(groupid) then -- if they are in the group PlayerRank = player:GetRoleInGroup(groupid) -- determines their rank RankLabel.Text = (PlayerRank.."") -- sets the Labels text to their rank. end if target:FindFirstChild("Mouseover") then script.Parent.Text = target.Mouseover.Value script.Parent.Visible = true end end end)
Let me know of any errors and I will help you.