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

How do I make this script print the item name?

Asked by
Uluomis 32
5 years ago
Edited 5 years ago

So I have this script that selects a random item in the pets table but it prints the amount of characters the name contains rather than the actual name. An example of this would be "Selected 5". I am wondering how to change this to make it print the item name. An example would be "Selected Fire Sword".

01local Pets = {
02    rarities = {0.6,0.4};
03    pets = {
04        {
05            name="Part";
06            rarity="Rare";
07        }
08        {
09            name="Part2";
10            rarity="Legendary";
11        }
12    };
13};
14 
15local totalweight = 0
View all 29 lines...

1 answer

Log in to vote
0
Answered by
oftenz 367 Moderation Voter
5 years ago

This seems like the obvious solution:

1print(Pets.pets[i] .. " has been chosen!")

Change to

1print(Pets.pets[i].name .. " has been chosen!")
0
It still prints the amount of characters of the name Uluomis 32 — 5y
1
nvm for some reason it doesn't like if you do #Pets so I had to do Pets thanks alot! Uluomis 32 — 5y
Ad

Answer this question