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

What does this error mean?

Asked by 10 years ago

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?

0
Is "ranks" defined? HexC3D 830 — 10y
0
Can we see the lines that deal with Ranks? Sublimus 992 — 10y
0
Agreed ^ HexC3D 830 — 10y
0
Sure. Ryan5124KBCP 15 — 10y
View all comments (2 more)
0
Mine will show all the ranks. HexC3D 830 — 10y
0
Done HexC3D 830 — 10y

3 answers

Log in to vote
1
Answered by
Sublimus 992 Moderation Voter
10 years ago

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."
0
Yeah, I need it to show all as you move up in the game. Ryan5124KBCP 15 — 10y
0
I'll answer one sec. HexC3D 830 — 10y
Ad
Log in to vote
1
Answered by
HexC3D 830 Moderation Voter
10 years ago
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
0
http://puu.sh/9kUbW/e8995e7eac.jpg It shows this, but I only want to show one depending on your XP. Ryan5124KBCP 15 — 10y
0
Mk. HexC3D 830 — 10y
0
There's already a xp value in the playerdata in Workspace. It's a model. Ryan5124KBCP 15 — 10y
Log in to vote
0
Answered by 10 years ago

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."
1
You know you can edit. HexC3D 830 — 10y
0
I answered! HexC3D 830 — 10y

Answer this question