Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Image id dosen't change?

Asked by 4 years ago
Edited 4 years ago

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

01local Slot1 = script.Parent.Slot1
02local Slot2 = script.Parent.Slot2
03 
04while true do
05    wait(1)
06if Slot1.Value == 1 then
07    Slot1.Image = ("http://www.roblox.com/asset/?id=183584653")
08else
09    Slot1.Image = ("http://www.roblox.com/asset/?id=1884857885")
10end
11 
12if Slot2.Value == 1 then
13    Slot2.Image = ("http://www.roblox.com/asset/?id=183584653")
14else
15    Slot2.Image = ("http://www.roblox.com/asset/?id=1884857885")
16    end
17    wait(1)
18end

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

its very unpractical to put it in a while loop. Try using events instead:

01local Slot1 = script.Parent.Slot1
02local Slot2 = script.Parent.Slot2
03local Slot1Check = --Create an IntValue
04local Slot2Check = --Create another IntValue
05 
06Slot1Check.Changed:Connect(function()
07if Slot1Check.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    Slot1.Image = ("http://www.roblox.com/asset/?id=183584653")
09else
10    Slot1.Image = ("http://www.roblox.com/asset/?id=1884857885")
11end
12end)
13 
14Slot2Check.Changed:Connect(function()
15if Slot2Check.Value == 1 then
16    Slot2.Image = ("http://www.roblox.com/asset/?id=183584653")
17else
18    Slot2.Image = ("http://www.roblox.com/asset/?id=1884857885")
19end
20end)
0
Line 3 & 4 you shouldn't put = Nguyenlegiahung 1091 — 4y
Ad

Answer this question