How to make a surface UI image move?

I want to make a main menu for my and my friend’s horror game and the menu is on a Computer (the menu is a surface UI) and I want to make it so the screen image moves creating a ‘‘Glitch Effect’’ (The screen image looks like this:

And I want the background of the screen to move up and back to the original position (Screen Glitch effect)

I tried to script that effect myself and it didn’t work and it feels really embarrassing that I messed up such a simple script
This is the script:

local Screen = script.Parent.Screen
local ScreenUp = script.Parent.ScreenUp

Screen.Transparency = 0.61
wait(10)
ScreenUp.Transparency = 0.61
wait(0.1)
ScreenUp.Transparency = 1 --I'm planning to adding loop for the function so it doesn't happen only once--

There were no posts about a similar problem.

There were no error messages in the output and when I checked the image transparency while in game it was still fully transparent.

Help

3 Likes

If I’m right, you can’t change the image’s transparency. However if you want it to move, change the position, Use

ScreenUp.Position = UDim2.new(0,0,0,0) -- Change this to whatever

and if you want it inside a loop, you could do it like this

while wait(.1) do
ScreenUp.Position = UDim2.new(0,0,0,0) -- Change this to whatever
wait(.1)
ScreenUp.Position = UDim2.new(0,0,0,0) -- Change this to whatever
end

and here’s more information about udim2

1 Like

It remains still
No errors in the output

1 Like

You’ve changed the position to something else right? like UDim2.new(5,5,5,5) for instance.
could you show the script perhaps?

2 Likes

I genuinely don’t think that is a surface GUI, if you would like to accomplish something exactly like that you could insert a regular GUI in the same position as the computer if the camera won’t move.

1 Like

I had changed it but it remained still

1 Like

robloxapp-20230325-1436566.wmv (1.2 MB)

1 Like

I can’t open that sadly, I’m on Mac, but could you show the script instead?

1 Like

It was just a video showing the camera movement to the guy

1 Like

The video simply shows the camera moving, so that leads me to believe it is not a regular GUI

1 Like

Which is why I can’t use a normal one

1 Like

Hold up, what position are you changing? is it a gui or are you changing the surfacegui’s position? Cause a surfacegui doesn’t have a position, it just contains guis.

1 Like

I changed the image frame’s position

1 Like

And it didn’t work right? I tried it myself, and it worked perfectly fine. Could you please show me the script? That way I can see whats wrong.

local Screen = script.Parent.Screen
local ScreenUp = script.Parent.ScreenUp
local Heavy = script.Parent.ScreenHeavy

ScreenUp.Position = UDim2.new(0,0,0,0)
wait(.1)
ScreenUp.Position = UDim2.new(0,0,0,-10) -- Change this to whatever
wait(.1)
ScreenUp.Position = UDim2.new(0,0,0,0)
while wait(.1) do
	ScreenUp.Position = UDim2.new(0,0,0,0) -- Change this to whatever
	wait(.1)
	ScreenUp.Position = UDim2.new(0,0,0,-10) -- Change this to whatever
end

I tried this, and it worked fine. Could you show me where it’s located, the hierarchy.

Like the scripts and images location?

Yeah, the explorer, like where it is

Workspace>MenuFolder>ScreenPart>Menu surfaceGUI>MainFrame>Folder for images>Script and the Image

Well this seems right, I have no idea why it isn’t working.
This is where mine is located
Screenshot 2023-03-25 at 14.01.02

and this is the script:

while wait(.1) do
	script.Parent.Frame.Position = UDim2.new(0,0,0,0)
	wait(.1)
	script.Parent.Frame.Position = UDim2.new(0,0,0,-10)
end

And it works without any problems.

1 Like