Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Image id dosen't change?

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

local Slot1 = script.Parent.Slot1
local Slot2 = script.Parent.Slot2

while true do
	wait(1)
if Slot1.Value == 1 then
	Slot1.Image = ("http://www.roblox.com/asset/?id=183584653")
else
	Slot1.Image = ("http://www.roblox.com/asset/?id=1884857885")
end

if Slot2.Value == 1 then
	Slot2.Image = ("http://www.roblox.com/asset/?id=183584653")
else
	Slot2.Image = ("http://www.roblox.com/asset/?id=1884857885")
	end
	wait(1)
end

1 answer

✓ Accepted answer

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

local Slot1 = script.Parent.Slot1 
local Slot2 = script.Parent.Slot2
local Slot1Check = --Create an IntValue
local Slot2Check = --Create another IntValue

Slot1Check.Changed:Connect(function()
if 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.]]
    Slot1.Image = ("http://www.roblox.com/asset/?id=183584653")
else
    Slot1.Image = ("http://www.roblox.com/asset/?id=1884857885")
end
end)

Slot2Check.Changed:Connect(function()
if Slot2Check.Value == 1 then
    Slot2.Image = ("http://www.roblox.com/asset/?id=183584653")
else
    Slot2.Image = ("http://www.roblox.com/asset/?id=1884857885")
end
end)

1 comment

0

Line 3 & 4 you shouldn't put =

This discussion is preserved as it was. New answers, comments, and votes are closed.