Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to ignore objects in a list? ]Simple problem I'm just stupid]

Guys I need help.. I want to make the script ignore the "Names" in the list but for some reason it won't work. Halp.

Here's the script:

local player = game.Players.LocalPlayer
local playername = player.Name
local mouse = player:GetMouse()
local list = {"Part","Grass","Room","Window","FrontWall","Model"} --Names to ignore
function hover()
for _= v ,#list do
if v == #list then 
game.Players:WaitForChild(playername).PlayerGui.Ob.Object.Visible = true
local text =  mouse.Target.Parent.Name
game.Players:WaitForChild(playername).PlayerGui.Ob.Object.Text.Text = mouse.Target.Name
game.Players:WaitForChild(playername).PlayerGui.Ob.Object.Position = UDim2.new(0,mouse.X,0,mouse.Y)
else
game.Players:WaitForChild(playername).PlayerGui.Ob.Object.Visible = false
end
end
end
mouse.Move:connect(hover)

1 comment

0

oh my gosh lack of idents

1 answer

✓ Accepted answer
local player = game.Players.LocalPlayer
local playername = player.Name
local mouse = player:GetMouse()
local list = {"Part","Grass","Room","Window","FrontWall","Model"} --Names to ignore

function hover()

for v=1 ,#list do
if list[v] == mouse.Target.Name then 
	game.Players:WaitForChild(playername).PlayerGui.Ob.Object.Visible = true
	local text =  mouse.Target.Parent.Name
	game.Players:WaitForChild(playername).PlayerGui.Ob.Object.Text.Text = mouse.Target.Name
	game.Players:WaitForChild(playername).PlayerGui.Ob.Object.Position = UDim2.new(0,mouse.X,0,mouse.Y)

else
	game.Players:WaitForChild(playername).PlayerGui.Ob.Object.Visible = false
end
end
end
mouse.Move:connect(hover)

1 comment

0

Ty!

This discussion is preserved as it was. New answers, comments, and votes are closed.