I am trying to make inventory so once player gets value 1 he gets an item but the image dosen't show up once i have i item
01 | local Slot 1 = script.Parent.Slot 1 |
02 | local Slot 2 = script.Parent.Slot 2 |
03 |
04 | while true do |
05 | wait( 1 ) |
06 | if Slot 1. Value = = 1 then |
07 | Slot 1. Image = ( "http://www.roblox.com/asset/?id=183584653" ) |
08 | else |
09 | Slot 1. Image = ( "http://www.roblox.com/asset/?id=1884857885" ) |
10 | end |
11 |
12 | if Slot 2. Value = = 1 then |
13 | Slot 2. Image = ( "http://www.roblox.com/asset/?id=183584653" ) |
14 | else |
15 | Slot 2. Image = ( "http://www.roblox.com/asset/?id=1884857885" ) |
16 | end |
17 | wait( 1 ) |
18 | end |
its very unpractical to put it in a while loop. Try using events instead:
01 | local Slot 1 = script.Parent.Slot 1 |
02 | local Slot 2 = script.Parent.Slot 2 |
03 | local Slot 1 Check = --Create an IntValue |
04 | local Slot 2 Check = --Create another IntValue |
05 |
06 | Slot 1 Check.Changed:Connect( function () |
07 | if Slot 1 Check.Value = = 1 then --[[Also, Slot1 and Slot2 don't have a Value (At least from what we can see). So you must create Another Variable.]] |
08 | Slot 1. Image = ( "http://www.roblox.com/asset/?id=183584653" ) |
09 | else |
10 | Slot 1. Image = ( "http://www.roblox.com/asset/?id=1884857885" ) |
11 | end |
12 | end ) |
13 |
14 | Slot 2 Check.Changed:Connect( function () |
15 | if Slot 2 Check.Value = = 1 then |
16 | Slot 2. Image = ( "http://www.roblox.com/asset/?id=183584653" ) |
17 | else |
18 | Slot 2. Image = ( "http://www.roblox.com/asset/?id=1884857885" ) |
19 | end |
20 | end ) |