local p = game.Players.LocalPlayer local mouse = p:GetMouse() local mP = mouse.Target local nm = script.Parent.uName.Text local hp = script.Parent.uHP.Text mouse.Move:connect(function() if mP then print "mp" if mP.Parent:FindFirstChild("Humanoid") or mP.Parent:FindFirstChild("TowerHumanoid") then print(mP.Parent.Name) hp = mP.Parent.Humanoid.Health nm = mP.Parent.Name end end end)
It doesn't even print "mp" :/
local nm = script.Parent.uName.Text local hp = script.Parent.uHP.Text
Here, nm and hp are being set to the value of whatever the text of uName and uHP is.
hp = mP.Parent.Humanoid.Health nm = mP.Parent.Name
This just changes the string value that hp and nm have, not the text of gui.
nm and hp should instead equal the actual gui instance.
mP is set to the value mouse's target before there is a target and mP is never updated with the new mouse target.
local p = game.Players.LocalPlayer local mouse = p:GetMouse() local mP = mouse.Target --equal gui instance local nm = script.Parent.uName local hp = script.Parent.uHP mouse.Move:connect(function() -- update mP mP = mouse.Target if mP then print "mp" if mP.Parent:FindFirstChild("Humanoid") or mP.Parent:FindFirstChild("TowerHumanoid") then print(mP.Parent.Name) --change text of gui instance hp.Text = mP.Parent.Humanoid.Health nm.Text = mP.Parent.Name end end end)