Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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)

0
oh my gosh lack of idents hiimgoodpack 2009 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
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)

0
Ty! wilsonsilva007 373 — 6y
Ad

Answer this question