I Need help BAD with switching between two ImageLables

I’m losing my mind on why this isn’t working. My Prints() are firing so I know the script is running all the way through, but the images are not switching on and off when button is clicked.

This video is me manually ticking the visible box of the two images that I’m trying to make work in the scrip below.
robloxapp-20220317-1524050.wmv (153.8 KB)

Inventory

local gui = game:GetService(“StarterGui”)

local item = script.Parent
local tool = game.ReplicatedStorage.ClassicSword
local purchased = script.Parent.Price
local swordSlotEquipped = gui.LobbyScreenGUI.InteractFrame.InventoryButton.InventoryFrame.InventoryScrollingFrame.InventoryVPFrame.SwordSlotEquipped
local swordSlotUnequipped = gui.LobbyScreenGUI.InteractFrame.InventoryButton.InventoryFrame.InventoryScrollingFrame.InventoryVPFrame.SwordSlotUnequipped

local function equipPurchasedItem()
if purchased.Text == “Equip” then
swordSlotUnequipped.Visible = true
swordSlotEquipped.Visible = false
purchased.Text = “Unequip”
print(“Nice new shinny sword!”)

	game.ReplicatedStorage.RemoteEvents.SwordRE:FireServer()	
end

end

local function unequipPurchasedItem()
if purchased.Text == “Unequip” then
swordSlotEquipped.Visible = true
swordSlotUnequipped.Visible = false
print(“Let’s Fight!”)
end
end

item.MouseButton1Click:Connect(equipPurchasedItem)
item.MouseButton1Click:Connect(unequipPurchasedItem)

1 Like

You are updating the ui inside StarterGui which is more like a storage. Contents in there get cloned to every player’s PlayerGui. So you should be using:
local gui = game.Players.LocalPlayer.PlayerGui

2 Likes