|
| 31 Jan 2015 08:03 PM |
Ok so in my game, you get to choose a name. However, there are preset names that you have to choose from that you can scroll through. How do I allow you to scroll through them without a bunch of if statements telling which name comes after which?
Sorry if this is a bit vague, this is the best way I could explain it. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
| |
|
| |
|
|
| 31 Jan 2015 08:09 PM |
You could make a table full of the names.
local names = {"Bob", "Janet", "Harry", "Michelle"} |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2015 08:11 PM |
But how would I use them from there? (I have actually never used a table before) |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2015 08:13 PM |
| Well, post your script and show me what you are working with, and I will try to adapt it with a table? |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2015 08:16 PM |
| I haven't written anything yet... Well at least nothing for the name changing bit. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2015 08:20 PM |
local names = {"Tom", "Michelle", "Ryan"}
for i = 1,3 do something.Text = names[i] end
Not going to do the whole script for you without you working on it, but this is the general idea for what you want. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2015 08:22 PM |
That would work, but the list of names is an image and I was planning on offsetting the image each time a player clicked on an up or down arrow. That part I can do, but I just don't know how to let the script know it changed without a bunch if statements saying which name goes to what.
(The reason its an image is because I wanted my own custom piratey font) |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2015 08:23 PM |
| If you could just tell me how without scripting it FOR me that would be great :P |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Jan 2015 08:38 PM |
| But then how would the game know which name you chose? |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2015 08:50 PM |
| Well whatever, the list of names I made was so long that ROBLOX lost all the resolution. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2015 09:11 PM |
| A ScrollingFrame works the same as a frame, have you not used a frame before? |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2015 09:42 PM |
| Yes but a ScrollingFrame scrolls via user input. |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Feb 2015 06:31 PM |
There are two arrows. One pointing up, one pointing down. The up arrow goes back up through the list (Z to A), and the down arrow goes down through the list of names (A-Z). Each time you click either of the arrows, a new name shows up depending on the direction of the arrow you clicked.
So lets say there are four names:
Aaron, Abraham, Adam, and Adrian.
If you click the up arrow and the name "Adam" is being displayed, the new name that should be displayed is "Abraham". If the name "Adrian" is being displayed and you click the down arrow, the new name that should be displayed is "Aaron". |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 01 Feb 2015 06:51 PM |
| Choosing a name for your character. |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2015 07:03 PM |
Hey there,
So I read through this, and I'd recommend doing this:
1) Rename each ImageButton to the names you want them. 2) Put a simple script in each of the buttons to check when a user has clicked, and then renames the player.
In this following script I am going to assume that you have a label displayed over the player's head to use as their name label. If this is not the case, oh well. You've gotta learn on your own, this is only to help clear things up. Also, this is going to be as simple as I can get:
script.Parent.MouseButton1Click:connect(function() Player = game.Players.LocalPlayer Player.PlayerGui.ScreenGui.CharacterName.Text = "YourNameHere" end) |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2015 08:53 PM |
| I actually just thought of a much more effective and easy way of doing it but would be too hard to explain here. |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2015 08:54 PM |
| One step closer to getting this game released on time! :D |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2015 08:56 PM |
I basically made a bot that made a whole bunch of string values for me containing the names and every time someone hits the up arrow it will just do currentName - 1:
num = 1
for i = 1, #maleNames do newString = Instance.new("StringValue",game.Workspace.MaleNames) newString.Name = num newString.Value = maleNames[i] num = num + 1 end
So yeah thats pretty much how I will be going about this |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2015 09:11 PM |
local Names = {"Name","SampleText","Shrek"}
blah.MouseButton1Down:connect(function() avalue.Value = avalue.Value + 1 end)
avalue.Changed:connect(function(thing) textlabel.Text = "Name: "..Names[avalue.Value] end) |
|
|
| Report Abuse |
|
|