Hey Developers, I’m creating a gamepass list and I want to have it organized as possible all through scripts without having to change text labels through the actual text properties an example I want.
is this possible? and if so how would I do this?
Hey Developers, I’m creating a gamepass list and I want to have it organized as possible all through scripts without having to change text labels through the actual text properties an example I want.
is this possible? and if so how would I do this?
That would be possible, yes. You would just put all of your information into a table containing all of the information you would want.
Example:
test1 = {
Title = "test",
Price = 1,
}
Then, just clone that template and start editing to your desires! You will also always use i to bring up a value in the table such as “Title” then the value aka v would be “Premium” ! An example is shown below!
for i, v in pairs(test1) do
local clonedTemplate = --Put template here
if i == "Title" then
clonedTemplate.Frame.TextLabel = v (Just an example)
end
end
end
Hope this helps!
Hello! This is possible, an example of changing the text inside a local script would be (without a variable)
game.Players.LocalPlayer.PlayerGui.yourscreengui.TextLabel.Text = “your text”
This is what I do to change text labels inside a local script.
Good luck!
When you say “clone” do you mean clone the actual frame? like ctrl d clone.
Ah, no my apologies! What I mean is finding the frame in script, then cloning it from there! Not doing the Crtl + D type of clone!
Ohh okay,
I’m a bit confused if I’m “redirecting” it right -
This is how the entire thing is setup
And I’m planning to do it with multiple things -
Anything will help! Thanks
Instead of having multiple Frames, just make 1 Frame named Template outside of the ScrollingFrame with a LocalScript being the parent of the Frame named Template. From there, you would then make multiple tables each containing all of the information you want in them. Then, make multiple for loops for each table and that should be about it. (Also probably a good idea to rename all of the frames named “Text” to “FrameText” or something like that to stop an error!)
Example:
PremiumInfo = {
Title = "Premium",
Price = 1000,
Description = "Be the coolest kid around town with this!"
}
VIPInfo = {
Title = "VIP",
Price = 500,
Description = "Be the kind of cool kid around town with this!"
}
for i, v in pairs(PremiumInfo) do
local clonedTemplate = script.Template:Clone()
if i == "Title" then
clonedTemplate.FrameText.FrameText.Header.Text = v
elseif i == "Price" then
clonedTemplate.Price.Price.Text = v
elseif i == "Description" then
clonedTemplate.FrameText.Frame.Bio.Text = v
end
end
Alright, I think it and is “clonedTemplate” the name of your actual frame or?
No, everytime you clone something you have to give the variable a name, so I just called it clonedTemplate for a clear understanding. The actual name of the frame is Template!
Ohh okay I keep getting this error everytime I play it
not sure if it matters but everything is hooked up into one script which “hub”
then multiple modules under ScriptLib
I advise you make a separate script just for the gamepass shop so that you can edit that freely and hopefully get no errors.
Well, just completely disregard the “Shop” frame and only focus on 1 of the frames used for a Template. Then put that frame into the LocalScript.
So define the frame? like
test = script.parent etc etc
No, clonedTemplate will be where you define the Template, which is script.Template since you put the Template inside of the LocalScript and test1 is just a table containing all of the information.
I see,
Everything is correct but this one part that I don’t understand I’ve tried every frame that coordinates with the description and it still comes up with the same error.
Hmmm… I have to go to bed right now so for now, watch this video to get a feel for how this will kind of work or if you want yours to be like this: - YouTube
Didn’t really go over the tables sadly,
Get back to me in the morning if you can!
Just use a WaitForChild before accessing the Shop frame in your script. Like this:
local clonedTemplate = script:WaitForChild("Shop").Template -- Or wherever the template is basically.
Sometimes objects load after scripts for the client.
Alright, basically you just want to insert a Template which can be any frame as long as it has what you want in it, into the LocalScript then from there make multiple tables and for loops inside of the script containing all of the information you want.
PremiumInfo = {
Title = "Premium",
Price = 1000,
Description = "Be the coolest kid around town with this!"
}
VIPInfo = {
Title = "VIP",
Price = 500,
Description = "Be the kind of cool kid around town with this!"
}
for i, v in pairs(PremiumInfo) do
local clonedTemplate = script.Template:Clone()
clonedTemplate.Parent = script.Parent.ScrollingFrame
if i == "Title" then
clonedTemplate.FrameText.FrameText.Header.Text = v
elseif i == "Price" then
clonedTemplate.Price.Price.Text = v
elseif i == "Description" then
clonedTemplate.FrameText.Frame.Bio.Text = v
end
end
for i, v in pairs(VIPInfo) do
local clonedTemplate = script.Template:Clone()
clonedTemplate.Parent = script.Parent.ScrollingFrame
if i == "Title" then
clonedTemplate.FrameText.FrameText.Header.Text = v
elseif i == "Price" then
clonedTemplate.Price.Price.Text = v
elseif i == "Description" then
clonedTemplate.FrameText.Frame.Bio.Text = v
end
end