MouseOver UI Not Working

No changes for the output when hovering

Can you please send the code you are now using

--Buttons
local B1 = game.Workspace.Automatic_Doors.Controllers.Controls:FindFirstChild("Button_1", true)
local B2 = game.Workspace.Automatic_Doors.Controllers.Controls:FindFirstChild("Button_2", true)
local B3 = game.Workspace.Automatic_Doors.Controllers.Controls:FindFirstChild("Button_3", true)
local B4 = game.Workspace.Automatic_Doors.Controllers.Controls:FindFirstChild("Button_4", true)
local B5 = game.Workspace.Automatic_Doors.Controllers.Controls:FindFirstChild("Button_5", true)
local B6 = game.Workspace.Automatic_Doors.Controllers.Controls:FindFirstChild("Button_6", true)

--Services & Plr
local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

UIS.InputBegan:Connect(function(input)
	print("connected")
	if Mouse.Target then
		print("mouse target")
		if Mouse.Target == B6 then
			print("B6")
			Player.PlayerGui.MouseOver.Enabled = true
		end
	end
end)

Line 17 should be

print(Mouse.Target)

Sorted! It says the target is Button_6 when hovering over it

Somewhere in the script (I guess line 8 works) can you please add

print(B6) 

and tell me what the output is?

B6 returns “nil” in the output

Throught so.

local B6 = game.Workspace.Automatic_Doors.Controllers.Controls:FindFirstChild("Button_6", true)

isn’t the path for the button, or it isn’t loaded.
Try replacing

:FindFirstChild("Button_6", true)

with

:WaitForChild("Button_6")
1 Like

Now its saying “Button_6” for line 8, but still no UI appears when hovering over

Does “B6” get outputted when hovering over the buttoN?

No, only connected and Button_6 when pressing

or when actually moving my character (but it doesn’t do it when I just move my mouse)

Are there going to be any other parts called Button_6 in the game?

Yes for when I use multiple of the doors around, but not elsewhere I don’t think

Will they all have the exact same behaviour (i.e. they make the UI visible)

Yes, the idea is that when the player hovers over the button to control the doors, the UI will appear which tells them what the button does and if they can interact with it.

The doors are already functional, but I’ve never tried to make MouseOver UI, so this is new to me

To be honest, I still reckon you should use the click detector’s MouseEnter thing, but if you don’t want to do that:

Replace the UIS function with:

UIS.InputBegan:Connect(function(input)
	if Mouse.Target and Mouse.Target.Name == "Button_6" then
		print("B6")
		Player.PlayerGui.MouseOver.Enabled = true
	else
		Player.PlayerGui.MouseOver.Enabled = false
	end
end)
1 Like

Thank you so much! This helped a load.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.