alright so i am new to using tables and on my script i got everything correct (or so i thought) and i can print out a value in my table no problem on any line but if i use that in a :FindFirstChild() even if i wrap it in tostring() it says that somehow argument 1 is missing or nil however that works
Script:
local Module = require(game.ServerScriptService.Interaction.LootTable)
local UiModule = require(game.ReplicatedStorage.LocalModules.CreateLootUI)
local LootAmount = math.random(1,7)
local Gui = script.Parent.LootBag
local MainFrame = Gui:WaitForChild("MainFrame")
local Storeloot = {}
print(LootAmount)
for count = 1, LootAmount do
local Item = MainFrame:WaitForChild("Item"..count)
Item.Visible = true
Item:WaitForChild("ItemName").Text = Module.ReturnLoot()
print(Item.ItemName.Text)
Storeloot[count] = Item.ItemName.Text
wait(.1)
end
for index = 1, #Storeloot do
print(index, Storeloot[index])
end
local Humanoid = script.Parent.Humanoid
local Event = Instance.new("RemoteEvent")
Event.Parent = script.Parent
Event.Name = "TakeLoot"
Event.OnServerEvent:Connect(function(Player,ArrayNumber)
if Humanoid.Health <= 0 then
local mag = (script.Parent.UpperTorso.Position - Player.Character.HumanoidRootPart.Position).magnitude
if mag <= 7 then
print(ArrayNumber,Storeloot[ArrayNumber])
if game.ServerStorage.LootItems:FindFirstChild(Storeloot[ArrayNumber]) then
if Storeloot[ArrayNumber]:Find(Storeloot[ArrayNumber],"Token") then
Player.CurrencyHolder.Tokens.Value = Player.CurrencyHolder.Tokens.Value + string.sub(Storeloot[ArrayNumber],7,#Storeloot[ArrayNumber])
else
game.ServerStorage:FindFirstChild(Storeloot[ArrayNumber]).Parent = Player.PlayerGui
end
end
end
end
end)

2 comments
Please clarify. Which lines are erroring? What are the errors? What is printed to output?
sorry forgot to say its line 30 and i said in the question the error