i have a script where when you position your mouse over any part that is lootable, it brings a textlabel to your mouse's position, and displays the name of the part. but for some reason it's not working. the script is located inside of a screengui. here is my script:
local plr = script.Parent.Parent.Parent local Char = plr.Character local label = script.Parent.TextLabel local mouse = plr:GetMouse() local Lootables = {"Small Stone", "Large Stone", "Gold"} mouse.Move:connect(function() if mouse.Target.Name == Lootables then print(mouse.Target.Name) label.Text = mouse.Target.Name label.Position = UDim2.new(0,mouse.X,0,mouse.Y) end end)
I think the problem is in line 8.
It's indeed in Line 8.
Currently you're just checking if the Name equals an entire table, which is never going to work, seeing that one is a string, and the other is a table.
you should do
if mouse.Target and Lootables[mouse.Target.Name] then
to check if the Target is in the loot table.
I also suggest changing your variable from Lootables to LootTables (double t)