This is my movement script.

right now the surface gui is on a part that moves when you press any button. is there a way to make the surface gui move and appear by pressing the button?

because right now it's moving and sometimes falls down. i have different sizes of brick it moves on. like one is 3 studs high. another is 2 and so on.

i have tried to use adornee but it never worked for this. maybe i was doing it wrong. i dont know.



local frame = game.Workspace.Part

function onKeyPress(inputObject)
    if inputObject.KeyCode == Enum.KeyCode.W then
        print("W was pressed")

        frame.Position = frame.Position + Vector3.new(5,0,0)
            
        
	elseif inputObject.KeyCode == Enum.KeyCode.D then
        print("D was pressed")
	frame.Position = frame.Position + Vector3.new(0,0,5)
	
	elseif inputObject.KeyCode == Enum.KeyCode.S then
        print("S was pressed")
	frame.Position = frame.Position + Vector3.new(-5,0,0)
	
	elseif inputObject.KeyCode == Enum.KeyCode.A then
        print("A was pressed")
	frame.Position = frame.Position + Vector3.new(0,0,-5)
        
        end
    
            
        end
    
game:GetService("UserInputService").InputBegan:connect(onKeyPress)