Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What does this error mean?

I've got this script and it throws an error.

This is the error

attempt to concatenate global 'Ranks' (a table value)

And the line that throws it is

script.Parent.heading.Text = "My rank: ".. Ranks ..". Click here for game stats."

Help?

6 comments

0

Is "ranks" defined?

0

Can we see the lines that deal with Ranks?

0

Agreed ^

0

Sure.

0

Mine will show all the ranks.

0

Done

3 answers

Your trying to concatenate a table, which of course, you can't do. You need to pull a certain value from the table to concatenate.

For example:

Ranks = {"Civillian", "Rookie", "Veteran", "Specialist", "Captain", "Commander", "Legend"}
script.Parent.heading.Text = "My rank: "..Ranks[1]..". Click here for game stats."

2 comments

0

Yeah, I need it to show all as you move up in the game.

0

I'll answer one sec.

Ranks = {"Civillian", "Rookie", "Veteran", "Specialist", "Captain", "Commander", "Legend"}

script.Parent.heading.Text = "My rank: "..table.concat(Ranks,',')..". Click here for game stats."

That should show all the ranks in the table.

Ok let's say you I made a IntValue to show XP

z = Isntance.new("IntValue",script.Parent)
z.Name = "XP"
Ranks = {"Civillian", "Rookie", "Veteran", "Specialist", "Captain", "Commander", "Legend"}
if z.Value == 1 then -- Example XP
script.Parent.heading.Text = "My rank: "..Ranks[1]..". Click here for game stats."
end
-- Another so you can get the point
if z.Value == 2 then -- Example XP
script.Parent.heading.Text = "My rank: "..Ranks[2]..". Click here for game stats."
end

3 comments

0

http://puu.sh/9kUbW/e8995e7eac.jpg It shows this, but I only want to show one depending on your XP.

0

Mk.

0

There's already a xp value in the playerdata in Workspace. It's a model.

Since the formatting is wrong on the comments, I'm putting the lines leading up to ranks here.

These are the lines leading up to ranks.

repeat wait() until workspace.playerdata:FindFirstChild(game.Players.LocalPlayer.Name)

data = Instance.new("ObjectValue")
data.Parent = script
data.Value = workspace.playerdata:FindFirstChild(game.Players.LocalPlayer.Name)

levels = {100,500,1250,2500,5000,10000}
Ranks = {"Civillian", "Rookie", "Veteran", "Specialist", "Captain", "Commander", "Legend"}
able = false

script.Parent.heading.Text = "My rank: ".. Ranks ..". Click here for game stats."

2 comments

1

You know you can edit.

0

I answered!

This discussion is preserved as it was. New answers, comments, and votes are closed.