So I have a GUI script, and I can’t set the text label to data from my module because it’s coming back as string. So I was wondering how I would go about, not having it come back as string.
LocalScript
--Module Variables--
local module = require (game.ReplicatedStorage.Modules.GuiWeponData)
local page = 1
local item = module[page]
--GUI Elements--
local ItemName = script.Parent.Name
while true do
wait(0.1)
ItemName.Text = item.Name
end
Module
local loot = {
[1] = {
Name = "Baseball Bat";
Description = "Useful for playing sports, and bashing in heads.";
Damage = 10;
AttackTime = .9;
Special = "N/A";
Rarity = 1
};
[2] = {
Name = "Brass Nuckles";
Description = "These bad-boys have a devistating punch.";
Damage = 13;
AttackTime = .5;
Special = "N/A";
Rarity = 1
};
[3] = {
Name = "Busted Pistol";
Description = "An old rusty pistol.";
Damage = 20;
AttackTime = .3;
Special = "25% chance of a jam while firing";
Rarity = 1
};
[4] = {
Name = "Stolen Police Baton";
Description = "Commonly used by police officers, unless stolen.";
Damage = 15;
AttackTime = .7;
Special = "N/A";
Rarity = 1
};
[5] = {
Name = "Mauser-C96";
Description = "A fully-automatic pistol.";
Damage = 22;
AttackTime = .05;
Special = "Fire of Glory: All damage increased by 10% for 7 secconds";
Rarity = 1
}
}
return loot
Error is 18:34:52.373 Players.DDZ_76.PlayerGui.ScreenGui.LocalScript:11: attempt to index string with 'Text' - Client - LocalScript:11