Hi, I want to make a module script to store all the variables and then call them in a local script. One tiny problem though, I have no idea how to use module scripts. I started experimenting with them using the Roblox API but I am pretty sure this is not the way to go about it. Can someone help?
-- // Module in StarterGUI \\
local module = {}
function module.Storefunc(stagetrans,steps)
if stagetrans.Text == "1" then
steps.Text = "100"
elseif stagetrans.Text == "2" then
steps.Text = "125"
elseif stagetrans.Text == "3" then
steps.Text = "125"
elseif stagetrans.Text == "4" then
steps.Text = "25"
elseif stagetrans.Text == "5" then
steps.Text = "200"
elseif stagetrans.Text == "6" then
steps.Text = "250"
elseif stagetrans.Text == "7" then
steps.Text = "110"
elseif stagetrans.Text == "8" then
steps.Text = "75"
elseif stagetrans.Text == "9" then
steps.Text = "75"
elseif stagetrans.Text == "10" then
steps.Text = "75"
elseif stagetrans.Text == "11" then
steps.Text = "125"
elseif stagetrans.Text == "12" then
steps.Text = "450"
elseif stagetrans.Text == "13" then
steps.Text = "200"
elseif stagetrans.Text == "14" then
steps.Text = "150"
elseif stagetrans.Text == "15" then
steps.Text = "200"
end
end
return module
-- // Local script in StarterGUI \\
local player = game.Players.LocalPlayer
local character = player.Character
local Humanoid = player.Character:WaitForChild("Humanoid")
local steps = player.PlayerGui.StepsGUI.Frame.TextLabel
local stagetrans = player.PlayerGui.StageTransfer.CurrentStage
local leaderstats = player.leaderstats.Stage
local mod = script.Parent.ModuleScript
local RunService = game:GetService("RunService")
print(steps.Text)
local info = require(mod,stagetrans,steps)
local info2 = info.Storefunc() --Get the module script values or something idk
stagetrans:GetPropertyChangedSignal("Text"):Connect(function()
--Store the variables in here (Like copy pasting the entire module script function
end)