-
What do you want to achieve? Keep it simple and clear!
My local script does not run, I want it to update the images of my ImageLabels. -
What is the issue? Include screenshots / videos if possible!
I believe the issue could be with the ‘if’ commands. But everytime I try to check it I do not find anything that would cause this script to not execute. There are no errors in the output. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I did not find any posts or anything that could help me the slightest in this script.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local occupied = script.occupied
local player = game.Players.LocalPlayer
local gensfolder = player:WaitForChild('gens')
local trashgen = gensfolder:WaitForChild('trashgen')
local cargen = gensfolder:WaitForChild('cargen')
local hatgen = gensfolder:WaitForChild('hatgen')
local tetrisgen = gensfolder:WaitForChild('tetrisgen')
if trashgen.Value > 0 and occupied == false and script.Parent.Parent.Item1 ~= trashgen.Decal.Texture and script.Parent.Parent.Item2 ~= trashgen.Decal.Texture and script.Parent.Parent.Item3 ~= trashgen.Decal.Texture and script.Parent.Parent.Item4.Image ~= trashgen.Decal.Texture then
script.Parent.Image = trashgen.Decal.Texture
occupied = true
script.Parent.Visible = true
elseif cargen.Value > 0 and occupied == false and script.Parent.Parent.Item1 ~= cargen.Decal.Texture and script.Parent.Parent.Item2 ~= cargen.Decal.Texture and script.Parent.Parent.Item3 ~= cargen.Decal.Texture and script.Parent.Parent.Item4.Image ~= cargen.Decal.Texture then
script.Parent.Image = cargen.Decal.Texture
occupied = true
script.Parent.Visible = true
elseif hatgen.Value > 0 and occupied == false and script.Parent.Parent.Item1 ~= hatgen.Decal.Texture and script.Parent.Parent.Item2 ~= hatgen.Decal.Texture and script.Parent.Parent.Item3 ~= hatgen.Decal.Texture and script.Parent.Parent.Item4.Image ~= hatgen.Decal.Texture then
script.Parent.Image = hatgen.Decal.Texture
occupied = true
script.Parent.Visible = true
elseif tetrisgen.Value > 0 and occupied == false and script.Parent.Parent.Item1 ~= tetrisgen.Decal.Texture and script.Parent.Parent.Item2 ~= tetrisgen.Decal.Texture and script.Parent.Parent.Item3 ~= tetrisgen.Decal.Texture and script.Parent.Parent.Item4.Image ~= tetrisgen.Decal.Texture then
script.Parent.Image = tetrisgen.Decal.Texture
occupied = true
script.Parent.Visible = true
end
trashgen.Changed:Connect(function()
if trashgen.Value > 0 and occupied == false and script.Parent.Parent.Item1 ~= trashgen.Decal.Texture and script.Parent.Parent.Item2 ~= trashgen.Decal.Texture and script.Parent.Parent.Item3 ~= trashgen.Decal.Texture and script.Parent.Parent.Item4.Image ~= trashgen.Decal.Texture then
script.Parent.Image = trashgen.Decal.Texture
occupied = true
script.Parent.Visible = true
elseif trashgen.Value == 0 and occupied == true and script.Parent.Image == trashgen.Decal.Texture then
script.Parent.Visible = false
occupied = false
script.Parent.Image = script.Parent.Parent.Parent.Parent.Currency.ImageLabel.Image
end
end)
cargen.Changed:Connect(function()
if cargen.Value > 0 and occupied == false and script.Parent.Parent.Item1 ~= cargen.Decal.Texture and script.Parent.Parent.Item2 ~= cargen.Decal.Texture and script.Parent.Parent.Item3 ~= cargen.Decal.Texture and script.Parent.Parent.Item4.Image ~= cargen.Decal.Texture then
script.Parent.Image = cargen.Decal.Texture
occupied = true
script.Parent.Visible = true
elseif cargen.Value == 0 and script.Parent.Image == cargen.Decal.Texture and occupied == true then
script.Parent.Visible = false
occupied = false
script.Parent.Image = script.Parent.Parent.Parent.Parent.Currency.ImageLabel.Image
end
end)
hatgen.Changed:Connect(function()
if hatgen.Value > 0 and occupied == false and script.Parent.Parent.Item1 ~= hatgen.Decal.Texture and script.Parent.Parent.Item2 ~= hatgen.Decal.Texture and script.Parent.Parent.Item3 ~= hatgen.Decal.Texture and script.Parent.Parent.Item4.Image ~= hatgen.Decal.Texture then
script.Parent.Image = hatgen.Decal.Texture
occupied = true
script.Parent.Visible = true
elseif hatgen.Value == 0 and script.Parent.Image == hatgen.Decal.Texture and occupied == true then
script.Parent.Visible = false
occupied = false
script.Parent.Image = script.Parent.Parent.Parent.Parent.Currency.ImageLabel.Image
end
end)
tetrisgen.Changed:Connect(function()
if tetrisgen.Value > 0 and occupied == false and script.Parent.Parent.Item1 ~= tetrisgen.Decal.Texture and script.Parent.Parent.Item2 ~= tetrisgen.Decal.Texture and script.Parent.Parent.Item3 ~= tetrisgen.Decal.Texture and script.Parent.Parent.Item4.Image ~= tetrisgen.Decal.Texture then
script.Parent.Image = tetrisgen.Decal.Texture
occupied = true
script.Parent.Visible = true
elseif tetrisgen.Value == 0 and script.Parent.Image == tetrisgen.Decal.Texture and occupied == true then
script.Parent.Visible = false
occupied = false
script.Parent.Image = script.Parent.Parent.Parent.Parent.Currency.ImageLabel.Image
end
end)
I’m sorry about the script being so long, but you could check only one of the ‘if’ commands since they are all almost the same. There are 4 IntValues inside the local player, I want the Images on the player’s inventory to update everytime one of the IntValues get a value higher than 0.
Nothing shows up on the inventory despite the IntValues being updated and being 1 or more.