Here's the script:
local Names = {"Tree","Apple","Bench","Bridge"}
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local ScreenGui = Player.PlayerGui:WaitForChild("ObjectGui")
local Title = ScreenGui:WaitForChild("Background"):WaitForChild("Title")
local Desc = ScreenGui:WaitForChild("Background"):WaitForChild("Description")
game:GetService('RunService').RenderStepped:connect(function()
local Y = Mouse.Y
local X = Mouse.X
if Mouse.Target then
if Mouse.Target ~= nil then
for i,v in pairs (Names) do
if Mouse.Target.Parent.Name then
if Mouse.Target.Parent.Name == v then --Error here: attempt to index field 'Target' (a nil value)
ScreenGui:WaitForChild("Background").Visible = true
ScreenGui:WaitForChild("Background").Position = UDim2.new(0,X,0,Y)
Title.Text = v
Desc.Text = Mouse.Target.Parent:WaitForChild("Description").Value
wait(.5)
ScreenGui:WaitForChild("Background").Visible = false
else
ScreenGui:WaitForChild("Background").Visible = false
end
end
end
end
end
end)
I tried to do if Mouse.Target ~= nil,If Target ~= nil,pcall(),if Mouse.Target.Name. And none of these worked for some reason. When I hover my mouse over the sky of the game, it makes the gui dissapear how it is supposed to, but it SPAMS a massive error message on the output saying that Mouse.Target is nil. How do I stop that? Am i missing something?

2 comments
Are you using a local script or a script?
Local script in a starter pack