Help locating a part in a folder

Hi, I am confused but I don’t know how to locate my screen part so it works.

Here is what i’m trying to locate:
image

Here’s my code:

local tvs = {}

local area = Workspace.screen:GetChildren()

local screen = 1

for i=1,#area do

table.insert(tvs,area[i])

end

function change(pic)

if screen ==1 then

screen =2

for i,v in next, tvs do

v.screen.SurfaceGui.Frame.screen2.Image = pic

v.screen.SurfaceGui.Frame.screen2.Position = UDim2.new(-1,0,0,0)

v.screen.SurfaceGui.Frame.screen1:TweenPosition(UDim2.new(1,0,0,0))

v.screen.SurfaceGui.Frame.screen2:TweenPosition(UDim2.new(0,0,0,0))

end

else

screen =1

for i,v in next, tvs do

v.screen.SurfaceGui.Frame.screen1.Image = pic

v.screen.SurfaceGui.Frame.screen1.Position = UDim2.new(-1,0,0,0)

v.screen.SurfaceGui.Frame.screen2:TweenPosition(UDim2.new(1,0,0,0))

v.screen.SurfaceGui.Frame.screen1:TweenPosition(UDim2.new(0,0,0,0))

end

end

end

function scrn1()

change(script.Parent.scrn1.Image)

end

function scrn2()

change(script.Parent.scrn2.Image)

end

function scrn3()

change(script.Parent.scrn3.Image)

end

function scrn4()

change(script.Parent.scrn4.Image)

end

function scrn5()

change(script.Parent.scrn5.Image)

end

function scrn6()

change(script.Parent.scrn6.Image)

end

function scrn7()

change(script.Parent.scrn7.Image)

end

function scrn8()

change(script.Parent.scrn8.Image)

end

function scrn9()

change(script.Parent.scrn9.Image)

end

function scrn10()

change(script.Parent.scrn10.Image)

end

script.Parent.scrn1.MouseButton1Click:connect(scrn1)

script.Parent.scrn2.MouseButton1Click:connect(scrn2)

script.Parent.scrn3.MouseButton1Click:connect(scrn3)

script.Parent.scrn4.MouseButton1Click:connect(scrn4)

script.Parent.scrn5.MouseButton1Click:connect(scrn5)

script.Parent.scrn6.MouseButton1Click:connect(scrn6)

script.Parent.scrn7.MouseButton1Click:connect(scrn7)

script.Parent.scrn8.MouseButton1Click:connect(scrn8)

script.Parent.scrn9.MouseButton1Click:connect(scrn9)

script.Parent.scrn10.MouseButton1Click:connect(scrn10)

Do you only need to get just that one screen? Or are there multiple screens?

local screenPart = MOVINGTRUSSFolder.MovingTruss.Truss1.WeldedParts.screen
1 Like

It didn’t work. Basically, how this works there are three screens and 2 panels. The two screens on the sides would simultaneously display a decal with one panel. The other one, the screen is in the middle it’s larger and what I did is put them to a moving truss so I can lower the screen anytime but the script doesn’t seem to work as it failed to locate it.

The side screens are alright and they work because they are just in workspace as a model but my only problem is the middle screen.

Could you post a screenshot with more of the explorer workspace stuff visible like the other screens in workspace, and are you trying to change the screen in the middle too?

1 Like

I script I sent is only the panel for the middle screen.
The screen panels are all the same scripts etc
Scribbled stuff means its unrelated
image image image image

The side ones are alright, they dont need changing. I just need help with the middle one since it doesnt work because it doesnt know where the screen is inside the movingtruss stuff

Where is the script that’s supposed to control the middle screen parented to?

This might be abit offtopic, but you have way too much unnecessarily code pal, you could use a for loop to avoid that; here is an example of something I put up quickly for you:

 local tvs = {}
 local area = Workspace.screen:GetChildren()
 local screen = 1
 
 for i=1,#area do
 	table.insert(tvs,area[i])
 end
 
 function change(pic)
 
 	if screen ==1 then
 		screen =2
 		for i,v in next, tvs do
 			v.screen.SurfaceGui.Frame.screen2.Image = pic
 			v.screen.SurfaceGui.Frame.screen2.Position = UDim2.new(-1,0,0,0)
 			v.screen.SurfaceGui.Frame.screen1:TweenPosition(UDim2.new(1,0,0,0))
 			v.screen.SurfaceGui.Frame.screen2:TweenPosition(UDim2.new(0,0,0,0))
 		end
 	else
 		screen = 1
 		for i,v in next, tvs do
 			v.screen.SurfaceGui.Frame.screen1.Image = pic
 			v.screen.SurfaceGui.Frame.screen1.Position = UDim2.new(-1,0,0,0)
 			v.screen.SurfaceGui.Frame.screen2:TweenPosition(UDim2.new(1,0,0,0))
 			v.screen.SurfaceGui.Frame.screen1:TweenPosition(UDim2.new(0,0,0,0))
 		end
 	end
 	
 end
 
 for i = 1, 10, 1 do
 	local screenIndex = "scrn"..i
 	script.Parent:WaitForChild(screenIndex).MouseButton1Click:Connect(function()
 		change(script.Parent:WaitForChild(screenIndex).Image)
 	end)	
 end
1 Like

? I sent the script above, thats the script for the middle screen panel.

The line of code I provided earlier should work, you just reference the whole path of the screen. I don’t know where MOVINGTRUSSFolder is parented to. Assuming it’s in workspace you would do:

local area = workspace.MOVINGTRUSSFolder.MovingTruss.Truss1.WeldedParts.screen
-- then do stuff with the "area"

If there is an error in the output then you should show it because saying “It didn’t work” doesn’t help

1 Like

image
That’s the error with the code you sent. And yes Movingtrussfolder is in workspace