Attempted to index nil with DName??
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:
03 | DName = "Testing Disaster" , |
04 | WhatItDoes = "This is just a test disaster. Nothing really." , |
08 | DName = "Testing Disaster 2" , |
09 | WhatItDoes = "This is just another test disaster." , |
14 | local AmountOfDisasters = 2 |
16 | print ( "There are " .. AmountOfDisasters .. " disasters in the game." ) |
19 | local UI = script.Parent.DisasterGui |
20 | local Item = UI.DisasterFrame |
22 | if AmountOfDisasters = = 1 then |
23 | print ( "There is 1 disaster in game!" ) |
24 | elseif AmountOfDisasters > 1 then |
25 | for i = 1 ,AmountOfDisasters, 1 do |
26 | local Frame = Item:Clone() |
27 | local Orgin = 0.5 -(i/ 10 ) |
28 | print (Orgin+((AmountOfDisasters+ 1 )* 0.05 )) |
31 | Frame.Position = UDim 2. new(Orgin+((AmountOfDisasters+ 1 )* 0.05 ), 0 , 0.9 , 0 ) |
32 | print (Disasters [ i ] .DName) |
33 | Frame.Disaster.Text = Disasters [ i ] .DName |
34 | Frame.Number.Text = Disasters [ i ] .Number |
36 | print (((AmountOfDisasters+ 1 )* 0.05 )) |