Local Script To module script Mobile and Pc?

You can write your topic however you want, but you need to answer these questions:

  1. Mobile or Pc Selection

  2. I want to Change the Variable and the inside the for i,v in pairs so how do I turn this to a Module script so I can require and after I require how do I pass the parameters depending on the if they are on mobile (NOTE: I Already know how to check if it’s mobile or pc) The Issue is passing parameters to a module (NOTE: Check Lines 54 and 20) Those Are the values I’m trying to change or make to a module script so I require it

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!


----------------
--[ Services ]--
----------------

local Tweenservice = game:GetService("TweenService")

-----------------
--[ Variables ]--
-----------------

--[[ Sound ]]--

local Enter = workspace.Game.Sounds.UISounds.Buttons.Enter
local Leave = Enter.Parent.Leave
local Click = Enter.Parent.Click

--[[ Buttons ]]--

local Inventoryname = script.Parent.Parent.LeftMiddlePC.InventoryName
local Shopname = Inventoryname.Parent.ShopName
local Settingsname = Inventoryname.Parent.SettingsName

--[[ Infos ]]--

local InfoEnter = TweenInfo.new(0.25,Enum.EasingStyle.Sine)
local InfoLeave = TweenInfo.new(0.5,Enum.EasingStyle.Sine)
local InfoClick = TweenInfo.new(0.10, Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,true)

--[[ Goals ]]--

local GoalEnter = {Size = UDim2.new(0.51, 0,0.065, 0)}
local GoalLeave = {Size = UDim2.new(0, 0,0.065, 0)}

local GoalClick = {Rotation = 90}

--[[ Functions ]]---

function EnterTween(TweenData)
	Tweenservice:Create(TweenData[1],TweenData[2],TweenData[3]):Play()
end
function ClickTween(...)
	local args = {...}
	Tweenservice:Create(args[1],TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,true),{Rotation = 90}):Play()
end



---------------------------------
--[ Buttons Handler Script UI ]--
---------------------------------


for _, button in pairs(script.Parent.Parent.LeftMiddlePC:GetDescendants()) do
	if  button:IsA("TextButton") then  

		local ButtonExitNames = {
			["Inventory"] = {Inventoryname,InfoLeave,GoalLeave};
			["Settings"] = {Settingsname,InfoLeave,GoalLeave};
			["Shop"] = {Shopname,InfoLeave,GoalLeave};
		}
		local ButtonEnterNames = {
			["Inventory"] = {Inventoryname,InfoEnter,GoalEnter};
			["Settings"] = {Settingsname,InfoEnter,GoalEnter};
			["Shop"] = {Shopname,InfoEnter,GoalEnter};
		}

		button.MouseEnter:Connect(function()
			if ButtonEnterNames[button.Name] then
				EnterTween(ButtonEnterNames[button.Name])
				if not Enter.IsPlaying then
					Enter:Play()
				end
			end
		end)

		--[[ Mouse Exit Functions ]]--

		button.MouseLeave:Connect(function()
			if  ButtonExitNames[button.Name] then
				EnterTween(ButtonExitNames[button.Name])
			end
		end)

		--[[ Open And Close Functions ]]--

		button.MouseButton1Click:Connect(function()
			if not button.Active then return end
			button.Active = false
			Click:Play()
			ClickTween(button.Parent.Parent)
			if  ButtonExitNames[button.Name] then
				EnterTween(ButtonExitNames[button.Name])
			end
			task.wait(1.3)
			button.Active = true

		end)
	end
end