I'm trying to use TextButtons to change text in a TextLabel to a string from an array, based on a NumberValue, if that makes any sense. My direct question is about line 26 and/or 35, on what I am I am doing with the array.
local name = {
"Bastion",
"Bricktops",
"Bridges",
"Cache",
"Castletops",
"Classic",
"Cross",
"Crown",
"Dust",
"Factory",
"Firefight",
"Meadows",
"Narrowgil",
"Pitgrounds",
"Remains",
"Steeltops",
"Stonebrick",
"Temple",
"Trainyard"}
function left()
if script.Parent.Parent.Parent.Parent.Parent:GetRankInGroup(80738) >= 16 then
if script.Parent.Value.Value >= 2 then
script.Parent.Value.Value = script.Parent.Value.Value - 1
script.Parent.Text = (""..name[script.Parent.Value.Value].."")
end
end
end
function right()
if script.Parent.Parent.Parent.Parent.Parent:GetRankInGroup(80738) >= 16 then
if script.Parent.Value.Value <= (#name-1) then
script.Parent.Value.Value = script.Parent.Value.Value - 1
script.Parent.Text = (""..name[script.Parent.Value.Value].."")
end
end
end
script.Parent.Parent.Left.MouseButton1Down:connect(left)
script.Parent.Parent.Right.MouseButton1Click:connect(right)
In psuedocode,
Define array,
function called left, if the player clicking is above rank 16 in group 80738 & if the number value is <= to 2, so it can go down to one, but no further, then decrease the value by one and change the textlabel to say the map name, based on the array end end end
same thing, but for increasing the value, rather than decreasing
Anyway, when I click on the textbutton that would increase the numbervalue & call the function 'right' I get the error: 22:55:20.357 - Players.Player1.PlayerGui.Control.Map.Label.Script:35: attempt to concatenate field '?' (a nil value)
This is the hierarchy, when played test in Play Solo. SurfaceGui is connected to a part via Adornee. http://i.imgur.com/cZvML3V.png
Also, and I know this is nudging being against the rules and I apologise, but if what I am doing is not allowed, does anyone have any ideas as to what I could do instead?

1 comment
Wow, formatting for psuedocode messed up, sorry about that. If you have any questions I'll be happy to answer them.