Hey there!
I made a script that can show player’s display name once mouse hovered them, but i dont want it to show my own name, because game is designed to be first person and this happens:
(Local player’s name isnt supposed to be on screen)
here’s the script:
--General--
local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Plr = Players.LocalPlayer
local PlrMouse = Players.LocalPlayer:GetMouse()
local Frame = script.Parent
local UI = Frame.PlrName
local Cam = workspace.CurrentCamera
local wt = 0.25
--Tweens--
local Tween = game:GetService("TweenService")
local Info = TweenInfo.new(wt)
local PT1 = Tween:Create(Frame, Info, {BackgroundTransparency = 0.5})
local PT2 = Tween:Create(UI, Info, {TextTransparency = 0})
PlrMouse.Move:Connect(function()
local CamPos = Cam.CFrame.Position
local Dir = CFrame.new(CamPos, PlrMouse.Hit.Position)
local Target = workspace:Raycast(CamPos,Dir.LookVector*8)
if Target then
local ActualTarget = Target.Instance.Parent
if not ActualTarget:FindFirstChildOfClass("Humanoid") then
ActualTarget = ActualTarget.Parent
if not ActualTarget:FindFirstChildOfClass("Humanoid") then
ActualTarget = nil
end
end
if ActualTarget then
local Player = Players:GetPlayerFromCharacter(ActualTarget)
if Player then
wait(0.01)
PT1:Play()
PT2:Play()
UI.Text = Player.DisplayName
Frame.Position = UDim2.new(0,PlrMouse.X,0,PlrMouse.Y)
end
else
--UI Gone
else
--UI Gone
end
end)
If you have any knowledge on how to solve it i’d appreciate that!