Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone help me with a mouse.Target problem?

Asked by
hudzell 238 Moderation Voter
10 years ago
local mouse = game.Players.LocalPlayer:GetMouse()
repeat wait() until game.Players.LocalPlayer.Character
service = game:GetService("RunService")
label = script.Parent.Label

mouse.Changed:connect(function()
    print(mouse.Target.Name)
    if mouse.Target.Name == "Head" or mouse.Target.Name == "Torso" or mouse.Target.Name == "Left Leg" or mouse.Target.Name == "Left Arm" or mouse.Target.Name == "Right Arm" or mouse.Target.Name == "Left Arm" or mouse.Target.Name == "BoxHead" then
        label.Visible = true
        label.Position = UDim2.new(0,mouse.X,0,mouse.Y+20)
        label.Text = mouse.Target.Parent.Name
    else
        label.Visible = false
    end 
end)

There is the code, the output is nothing, no errors and the label is not popping up. Can anyone help?

The layout is here.

Answer this question