Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I go across making a character editor?

Asked by 10 years ago

Okay, I dont want to sound like I am asking for an entire script to be created and laid out in front of me on the shot, but I am just completely stumped on how I would go across making a menu where the player can create an avatar with pre-set body parts they can choose from when they enter a game for the first time. I am not asking for anyone to MAKE me a script, I just want to know the basics; if there are any particular methods/events I should use, does it need to be multiple scripts, what I might need to do to set it up. Sorry if this seems like a script request, but I just dont know any other way to put it. Thanks!

1 answer

Log in to vote
1
Answered by
TheMyrco 375 Moderation Voter
10 years ago

How I would do it: Make a GUI and two tables. The first table contains a string with the name of whatever is represented or the colour of the body part, and the second table contains all the corresponding images. The keys (indexes) of the second table are the same values of the first table. For example:

local values = {"Black Hat", "White Hat", "Pirate Hat"}
local images = {["Black Hat"] = LINK, ["White Hat"] = LINK, ["Pirate Hat"] = LINK}

Then you create a variable containing the number x.

local index = 1

And load the first image on the GUI and, additionally, with the text/description (first table) under the or next to the image. Then every time it is clicked you increase the variable with the number (index = index + 1). Then you check if that value is greater than the total indexes of the table: if index < #values then. If so, set that value to 1 (index = 1) and load the first image, if not, then then you simply load the current image.

local image = images[values[index]]

That piece of code first finds the value in the first table (values[index]) and tries to find the corresponding value with that index in the second table (images[_OUTCOME_]).

Then, if the player chooses it, you load the items/the character.

P.S: This can also be done when decreasing in value (going back in the GUI-picker) by, instead of adding 1, decreasing 1 and checking if it's less than 1 to start at the last index.

0
This really helps! I had never though of linking somthing up like that. Thanks! :D AwsomeSpongebob 350 — 10y
0
Np :) TheMyrco 375 — 10y
Ad

Answer this question