Script unable to change rotation of ImageLabel

Hello and thank you for reading my post. I am trying to get a script to change the rotation of an ImageLabel, but nothing is happening. I originally tried to animate this rotation using TweenService, but even testing a simple .Rotation = 90 does not work. There are no errors, and placing a print() after the line shows it in the output, meaning the script has past that line. Any help would be appreciated!

Update: Rotation isn’t the only problem. I just tried to make the script set Visible to false and it did nothing.

Please show me your script so I can see what’s wrong.

Are there any specific parts that you are looking for? It’s quite a long script. I’ve mentioned that there are no errors and that this would work normally. A section or idea to start with would help.

Preferably the first 50 lines or something

I’ll exclude a bit of the script. It might be hard to understand. This is a countdown clock for public transport, by the way.

while wait(0.5) do
	for index, descendant in pairs(script.Parent:GetDescendants()) do
		if descendant.Parent.Name == "Displays" then
			if descendant.Parent.Parent.TrainValues.Arrival1.Value == false then
				descendant.Screen1.ScreenFrame.Main.Visible = false
				descendant.Screen1.ScreenFrame.Idle.Visible = true
				if descendant:FindFirstChild("Screen2") ~= nil then
					descendant.Screen2.ScreenFrame.Main.Visible = false
					descendant.Screen2.ScreenFrame.Idle.Visible = true
				end
			else
				descendant.Screen1.ScreenFrame.Main.Visible = true
				descendant.Screen1.ScreenFrame.Idle.Visible = false
				local bullet = getbullet(descendant.Parent.Parent.TrainValues.Arrival1.RouteS.Value)
				local dest = ""
				if descendant.Parent.Parent.TrainValues.Arrival1.DestS.Value == "Not In Service" then
					dest = "<b>Train not stopping</b>"
				else
					dest = "to <b>" .. descendant.Parent.Parent.TrainValues.Arrival1.DestS.Value .. "</b>"
				end
				local stopsaway = ''
				if descendant.Parent.Parent.TrainValues.Arrival1.StopsAway.Value == 1 then
					stopsaway = '<b>1</b><font size = "8"><br/>stop away</font>'
				else
					stopsaway = '<b>' .. descendant.Parent.Parent.TrainValues.Arrival1.StopsAway.Value .. '</b><font size = "8"><br/>stops away</font>'
				end
				if descendant.Screen1.ScreenFrame.Main.Info1.Train1.Route.Image ~= bullet or descendant.Screen1.ScreenFrame.Main.Info1.Train1.Dest.Text ~= dest then
					descendant.Screen1.ScreenFrame.Main.Info1.Train2.Route.Image = bullet
					descendant.Screen1.ScreenFrame.Main.Info1.Train2.Dest.Text = dest
					TweenService:Create(descendant.Screen1.ScreenFrame.Main.Info1.Train1, TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.InOut), {Position = UDim2.new( 1.1, 0, 0, 0 )}):Play()
					TweenService:Create(descendant.Screen1.ScreenFrame.Main.Info1.Train2, TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.InOut), {Position = UDim2.new( 0, 0, 0, 0 )}):Play()
				end
				descendant.Screen1.ScreenFrame.Main.Distance1.Text = stopsaway
				if descendant.Parent.Parent.TrainValues.Arrival1.Track.Value == -1 then
					descendant.Screen1.ScreenFrame.Main.Arrow1.Visible = true
					--TweenService:Create(descendant.Screen1.ScreenFrame.Main.Arrow1, TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.InOut), {Rotation = -90}):Play()
					descendant.Screen1.ScreenFrame.Main.Arrow1.Rotation = -90
				elseif descendant.Parent.Parent.TrainValues.Arrival1.Track.Value == 1 then
					descendant.Screen1.ScreenFrame.Main.Arrow1.Visible = true
					--TweenService:Create(descendant.Screen1.ScreenFrame.Main.Arrow1, TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.InOut), {Rotation = 90}):Play()
					descendant.Screen1.ScreenFrame.Main.Arrow1.Rotation = 90
				else
					descendant.Screen1.ScreenFrame.Main.Arrow1.Visible = false
				end
				if descendant.Parent.Parent.TrainValues.Arrival1.StopsAway.Value == 0 then
					TweenService:Create(descendant.Screen1.ScreenFrame.Main.Info1.Train1, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB( 255, 255, 0 )}):Play()
					if descendant:FindFirstChild("Screen2") ~= nil then
						TweenService:Create(descendant.Screen2.ScreenFrame.Main.Info1.Train1, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {BackgroundColor3 = Color3.fromRGB( 255, 255, 0 )}):Play()
					end
				end
			end
		end
	end
end

Might I see the explorer where the script is located, so the parent, descendants, etc.

The script is designed to affect all displays at the same time, so I’m using two scripts at the most right now. The script shown is from “CDCInfoScript.”
image
image

So here’s the issue, you’re looking for a descendant that is called “Displays” and then you’re doing descendant.Screen1 which is wrong, because you need to do descendant.Display1.Screen1. Not sure why it does not error though.

Incorrect. Display1 is descendant in this case.

Okay you’re right. I saw it wrong. Why are you doing it like that though:

if descendant.Parent.Name == "Displays" then

Why check the descendant’s parent’s name. lol
I think you’re better off to doing this instead:

local descendant = script.Parent:FindFirstChild("Display1", true)

The script is detecting every display that is parented under the “Displays” folder. They are named Display1, Display2, etc. This script changes multiple displays at the same time.

Oh I see, that’s unusual. I can’t really tell why it’s not working then if it does print. Perhaps something external is causing the issue. Final note: you should really organize your code lol, this is hard to look at. Good luck with it nonetheless.

1 Like

Thanks for trying to help anyway!

Found the issue: turns out my original Arrow1 frame was not deleted for some reason along with the Arrow2 frame, and my eyes were oblivious to it this whole time, so the script was modifying it instead of the image this whole time.