So I have this UI script for my game that is like city smash. I keep getting this same error and I need help.
Code:
local Disasters = { Testing = { DName = "Testing Disaster", WhatItDoes = "This is just a test disaster. Nothing really.", Number = 1 }, Testing2 = { DName = "Testing Disaster 2", WhatItDoes = "This is just another test disaster.", Number = 2 }, } local AmountOfDisasters = 2 print("There are ".. AmountOfDisasters .." disasters in the game.") function LoadSpots() local UI = script.Parent.DisasterGui local Item = UI.DisasterFrame if AmountOfDisasters == 1 then print("There is 1 disaster in game!") elseif AmountOfDisasters > 1 then for i = 1,AmountOfDisasters,1 do local Frame = Item:Clone() local Orgin = 0.5-(i/10) print(Orgin+((AmountOfDisasters+1)*0.05)) Frame.Visible = true Frame.Parent = UI Frame.Position = UDim2.new(Orgin+((AmountOfDisasters+1)*0.05),0,0.9,0) print(Disasters[i].DName) Frame.Disaster.Text = Disasters[i].DName Frame.Number.Text = Disasters[i].Number end print(((AmountOfDisasters+1)*0.05)) end end LoadSpots()
You can't index a table with a set value.