I'm trying to get the input "E" to tween my GUI into a position on screen but when I do it nothing happens.

here is the script:

-- Main Variable --

local Menu = game.StarterGui.ScreenGui.MenuGUI

-- Sub Menu Variables --

local Profile = Menu.Profile
local Friends = Menu.Friends
local Messages = Menu.Messages
local Location = Menu.Location
local Settings = Menu.Settings

-- Profile Image Variable --

local PFP = Menu.PlayerProfile

-- Input Variables --

local UIS = game:GetService('UserInputService')
-- Change GUI Position --

-- E to activate GUI -- 

UIS.InputBegan:Connect(function(input,gameprocessed)
	if input.KeyCode == Enum.KeyCode.E then
		Profile:TweenPosition(UDim2.new(0.114,0,0.213,0),"In","Quad",1)
		Friends:TweenPosition(UDim2.new(0.114,0,0.383,0),"In","Quad",1)
		Messages:TweenPosition(UDim2.new(0.114,0,0.553,0),"In","Quad",1)
		Location:TweenPosition(UDim2.new(0.114,0,0.723,0),"In","Quad",1)
		Settings:TweenPosition(UDim2.new(0.114,0,0.897,0),"In","Quad",1)
		print("Menu GUI Activated")
		wait(1)
	end
end)


even though the GUI doesn't move into screen it still prints "Menu GUI Activated". I've tried all that I know and nothing works.

Please help

1 comment

0

Its because you're accessing the GUI from starter gui instead of the players gui, what you should do is local local player = game.Players.LocalPlayer local Menu = player.PlayerGui.Menu