Just wondering why my mouse.Target script is not pulling up my GUI?
01 | local UIS = game:GetService( "UserInputService" ) |
06 | local player = game.Players.LocalPlayer |
07 | local mouse = player:GetMouse() |
09 | local PlayerGui = player:WaitForChild( "PlayerGui" ) |
10 | local ForageInfoGui = PlayerGui:WaitForChild( "ForageInfoGui" ) |
11 | local Foragenoed = PlayerGui:WaitForChild( "Foragenoed" ) |
13 | UIS.InputChanged:Connect( function (input) |
15 | if mouse.Target:FindFirstChild( "Edible" ) then |
17 | local item = mouse.Target |
18 | ForageInfoGui.Adornee = item |
19 | ForageInfoGui.ObjectName.Text = item.Name |
20 | ForageInfoGui.Enabled = true |
23 | ForageInfoGui.Adornee = nil |
24 | ForageInfoGui.Enabled = false |
26 | if mouse.Target:FindFirstChild( "Forage" ) then |
28 | local item = mouse.Target |
29 | Foragenoed.Adornee = item |
30 | Foragenoed.ObjectName.Text = item.Name |
31 | Foragenoed.Enabled = true |
35 | Foragenoed.Adornee = nil |
36 | Foragenoed.Enabled = false |
When the item has a bool value called "Forage" it does not work.
However, when the item has a bool value called "Edible" it works.
Both bool values are enabled and both GUI's are disabled.