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")
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)
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.