Hi all, So today I'm trying to make a GUI that appears with a characters information when someone mouses over that character. So far I've only gotten it to work with a tool in hand. My goal is to not have to have any tool involved and just be able to mouse over the character and obtain his name and put it on a GUI.
Here's what I have so far:
wait(3) local TOOL = script.Parent local SCREEN_GUI = TOOL.ScreenGui local FRAME = SCREEN_GUI.Frame local TARG_LABEL = FRAME.NameLabel function getPC() local player = TOOL.Parent.Parent local char = player.Character return player, char end function canUse(part) if part == nil then return false end local bool = false return bool end function onMouseMove(mouse) local targ = mouse.Target TARG_LABEL.Text = "" while targ == nil do wait(10000000) end if canUse(targ) and targ then if targ.Locked and targ then TARG_LABEL.Text = targ.Name --This shows what its looking for else end else TARG_LABEL.Text = targ.Name end end function onSelected(mouse) local player = TOOL.Parent.Parent local p_gui = player.PlayerGui SCREEN_GUI.Parent = p_gui mouse.Move:connect(function() onMouseMove(mouse) end) end TOOL.Selected:connect(onSelected)
Right now it grabs a brick name and displays it's name, but eventually I'll try and change it to get a characters name.
Use player:GetMouse() in a local script. It will do the same as getting the mouse with the tool.