I currently have a script to show a player’s info.
I am trying to make it only appear if they are close enough.
how would I do this?
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("ShowMouseOver") and target.Parent:FindFirstChild("HumanoidRootPart") then
script.Parent.Text = target.Parent.Name.."/n"..target:GetRoleInGroup(4881614)
script.Parent.Visible = true
end
if target:FindFirstChild("Mouseover") then
script.Parent.Text = target.Mouseover.Value
script.Parent.Visible = true
end
end
end)
What is the problem here/what doesnt work? Also I’m assuming you are trying to make a line break in this line: script.Parent.Text = target.Parent.Name.."/n"..target:GetRoleInGroup(4881614)
Do \n instead of /n
How would I do this?
also no, /n works.
Get the player’s character position. Then check if the mouse target’s position - character position magnitude is less than a certain number
…
please stupid this down for me. -_-
local char = player.Character or player.CharacterAdded:Wait()
local pos1 = char.HumanoidRootPart.Position
local pos2 = target.Position
if (pos1 - pos2).magnitude < Maximum Distance then
end
So if I am correct, the code should be
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
local char = player.Character or player.CharacterAdded:Wait()
local pos1 = char.HumanoidRootPart.Position
local pos2 = target.Position
if (pos1 - pos2).magnitude < 20 then
if target.Parent:FindFirstChild("ShowMouseOver") and target.Parent:FindFirstChild("HumanoidRootPart") then
script.Parent.Text = target.Parent.Name.."/n"..target:GetRoleInGroup(4881614)
script.Parent.Visible = true
end
if target:FindFirstChild("Mouseover") then
script.Parent.Text = target.Mouseover.Value
script.Parent.Visible = true
end
end
end
end)
ok. it doesn’t. what am I doing wrong? 
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:FindFirstChild('Humanoid') then
local char = player.Character or player.CharacterAdded:Wait()
local pos1 = char.HumanoidRootPart.Position
local pos2 = target.Parent.HumanoidRootPart.Position
if (pos1 - pos2).magnitude < 20 then
if target.Parent:FindFirstChild("ShowMouseOver") and target.Parent:FindFirstChild("HumanoidRootPart") then
script.Parent.Text = target.Parent.Name.."/n"..target:GetRoleInGroup(4881614)
script.Parent.Visible = true
end
if target:FindFirstChild("Mouseover") then
script.Parent.Text = target.Mouseover.Value
script.Parent.Visible = true
end
end
end
end)
Is this a screen gui? If so then use PlayerGui to edit it
You would need to use;
(what_ever_you_called_player_here).PlayerGui
From there all the GUI’s on the players side is located.
But game.StarterGui.(GUI_Name_Here)
is Server Sided and appears for everyone.
??? This makes no sense to me ???
breakdown;
local player = game:GetService("Players").LocalPlayer
player.PlayerGUI --Get access to the players GUI (player sided)
game.StarterGui --This is displayed for every player in game (server sided)