New to coding, trying to figure out how to make this work

This script that I have created is not working. It prints “working”, but it does not tween the position of the gui. I am relatively new to coding, so this boggles my mind, and I’ve tried to find tutorials but can’t find an exact solution. What I assume is that the script is breaking because the “menu” variable is seperated from the script. I also assume that I must then need a remote event or function in order to activate another script within the gui to make it work. If a scripter could help me find a solution, it would be much appreciated.

local UIS = game:GetService('UserInputService')
local TS = game:GetService("TweenService")
local Info = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
local menu = game.StarterGui.ScreenGui.Menu

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.M then
		print("working")
		menu:TweenPosition(UDim2.new(0.5,0,0.5,0))
	end
end)
local UIS = game:GetService('UserInputService')
local TS = game:GetService("TweenService")
local Player = game:GetService("Players").LocalPlayer
local Info = TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
local menu = Player:WaitForChild("PlayerGui").ScreenGui.Menu

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.M then
		print("working")
		menu:TweenPosition(UDim2.new(0.5,0,0.5,0))
	end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.