So I’m trying to make a script that shows a little description on the brick that the mouse is hovering over. I get an error and I can’t quite find a solution as to how I can fix my code.
Code:
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local mouse = player:GetMouse()
lookTableNames = {workspace:WaitForChild("BedLookPart"),workspace:WaitForChild("ClockLookPart")}
local function showDescription(plr,part)
if hrp.Anchored == false then
print("debug3")
local bill = part:FindFirstChild("BillboardGui")
bill.Enabled = true
part.MouseLeave:Connect(function()
bill.Enabled = false
end)
end
end
for _, part in pairs(workspace:GetChildren()) do
if table.find(lookTableNames,part) then
print("debug1")
part.MouseEnter:Connect(function()
print("debug2")
showDescription(game.Players.LocalPlayer, part)
end)
end
end
Only the first debug message works
Error: