local player = game.Players.LocalPlayer local mouse = player:GetMouse() --Getting the player's mouse mouse.Move:connect(function() --When the mouse moves local target = mouse.Target local selection = Instance.new("SelectionBox", player.PlayerGui) selection.Name="Jerry" selection.Color = BrickColor.new("Cyan") if mouse.Target.Name=="JerryBlock" and mouse.Target:IsA("BasePart") then selection.Adornee=target else player.PlayerGui.Jerry.Adornee=nil end end)
This is supposed to add a selection box around a an NPC. JerryBlock is a Part that I put inside the NPC's model.
The only thing not working is that the selection box wont disappear when the mouse exits.
The script is a LocalScript in StarterPlayerScripts. This is a portion of the script.