I'm trying to make a screengui show up when your mouse hovers over a brick, which I have actually got to work. My problem though comes when I try to set it to work at a distance of 10 studs or less.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
if (torso.Position - game.Workspace.Part1.Position).magnitude <11 then
mouse.Move:connect(function()
if mouse.Target and mouse.Target == game.Workspace.Part1 then
player.PlayerGui.SpecialHoverGUI.Frame.Visible = true
else
player.PlayerGui.SpecialHoverGUI.Frame.Visible = false
end
end)
I can't for the life of me understand what's going wrong. (I am a novice scripter which would probably explain a lot). Please help!

1 comment
This is so hard to read oml. Check the answer below, pretty sure its correct.