Module Script Issue

I am currently trying to use a module script for properties in StarterGui. I have my local script inside of the GUI and the module script inside of replicated storage. Here is the scripts below;

Module Script:
local poproperties = {}

poproperties.UI = game.StarterGui.PremiumOffer
poproperties.MainFrame = game.StarterGui.PremiumOffer.MainFrame
poproperties.CutOff = game.StarterGui.PremiumOffer.MainFrame.InnerFrame.CutOff
poproperties.Button = game.StarterGui.PremiumOffer.MainFrame.InnerFrame.PurchaseButton
poproperties.Logo = game.StarterGui.PremiumOffer.MainFrame.InnerFrame.PremiumLogo
poproperties.Title = game.StarterGui.PremiumOffer.MainFrame.InnerFrame.Title
poproperties.Price = game.StarterGui.PremiumOffer.MainFrame.InnerFrame.Price
poproperties.Perks = game.StarterGui.PremiumOffer.MainFrame.InnerFrame.Perks

return poproperties

Local Script:

local POProperties = require(game.ReplicatedStorage:WaitForChild(“POProperties”))

POProperties.MainFrame:TweenPosition(UDim2.new(0.394, 0,0.25, 0), “Out”, “Quart”, 0.25)

Issue: It will not tween the GUI. I’ve tried countless of times by putting the module script in different services, but it just wouldn’t work. Anyone know why?

I know why. You’re simply saying game.StarterGui.
But when the game starts it gets replicated to game.Players.LocalPlayer.PlayerGui. Thats why it doesn’t want to tween your gui element

1 Like

I have tested earlier with printing the GUI name, and it works. It just doesn’t work with it manually changing the properties.

Because on the start of the game StarterGui will stay there. So that’s why it printed out the name.

I see. So do I just change each line to game.Players.LocalPlayer.PlayerGui.(property stuff here)?

yes. but for easier use you could put this at the start of the module script

local starterGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")

this single line will make your script look cleaner

Alright, let me change it really quickly.