Scripting support

Hello! I am creating an avatar editor system! I would like to make it so there is a module script and it contains all of the items. Next to each item would be its properties such as the price the person who created it and its category, etc! It would then get all of the items from the module and clone a GUI frame for each item and change the things depending on what it says. However, I am unsure how to do this? Can I get support on how to do this!?? Thanks!

Here is a screenshot of a stream I watched that inspired this technique!

https://www.youtube.com/watch?v=opXBcFZ9Hlw this might help you

Create a table like so:

local hats = {
    ["Dominus"] = {
["Price"] = 5000,
["Rarity"] = "Legendary"
   },
}

Then to get the price do:

hats["Dominus"].Price

To get the rarity do:

hats["Dominus"].Rarity

You can configure this to what you want.

1 Like

Ah ok thanks!! How would I clone a gui for each one??

Well you could use a UIGrid object and a UIRatioAspect object to make the guis line up. To clone a gui for every item you could loop through that table like so:

for i,v in pairs(hats) do -- loops through the table
local hat = hats[v]
local newgui = gui:Clone() -- make sure to say what the gui is. This is cloning the gui.
newgui.Parent = -- wherever you want it to go
newgui.Title.Text = hat
newgui.Price.Text = hat.Price
newgui.Rarity.Text = hat.Rarity
end

Something like this should work.

Aw thanks! It helps A LOT!! Thank you!

1 Like

Sure thing! If you need any help or something goes wrong, feel free to ask me!

1 Like

I have put the clone in a local script however, it says the the module im trying to get doesnt exist in serverscriptservice!? Ill show you the script!


for i,v in pairs(module.hair) do 
	local hair = module.hair[v]
	local newgui = script.Parent.HairFrame.Hair1:Clone()
	newgui.Parent = script.Parent.HairFrame
	newgui.Name.Text = hair
	newgui.MadeBy.Text = hair.Creator
	newgui.Name = hair
end```

If your trying to access ServerScriptService from a Local script unfortunately that is not possible, Only ServerScriptService can be accessed by a script.

Getting a module via serverscriptservice will print an error because the serverscriptservice can only be accessed by the server (scripts) and not by the client (local scripts). You should use a server side script.

1 Like

I made this for a viewport frame but the camera doesnt seem to work? It puts the hair and cam into the frame but i cant see it?

	local cam = game.ReplicatedStorage:FindFirstChild(newHair):Clone()
	cam.Parent = newgui.ImageButton.ViewportFrame
	local camera = Instance.new("Camera")
	camera.CFrame = CFrame.new(cam.PrimaryPart.Position + (cam.PrimaryPart.CFrame.lookVector * 1),cam.PrimaryPart.Position)
	camera.Parent = newgui.ImageButton.ViewportFrame```
1 Like

Hmm. I’m not the best with camera’s and all but I don’t think you have to create a camera. It most likely is because of your math. Maybe try: camera.CameraSubject = cam

You wouldnt be able to help me with the script to get it to go onto the head would u??

I started it but it just wont work?

1 Like

Could you explain further of how your doing it and what your scripts’ sources are?