So I’m trying to make a GUI where if you click a button, a textlabel that says “Equipped” will appear on it to indicate that it’s equipped. But for some reason, It doesn’t set the position properly. Here’s the code:
local player = game.Players.LocalPlayer
local armoryGUI = player.PlayerGui.ArmoryGui
local gadgetsFrame = armoryGUI.InventoryFrame.GadgetsFrame
gadgetsFrame.ChildAdded:Connect(function(button)
if button:IsA("ImageButton") then
button.MouseButton1Click:Connect(function()
local gadget = button.Name
local armoryGUI = player.PlayerGui.ArmoryGui
local inventoryFrame = armoryGUI.InventoryFrame
local equippedLabel = inventoryFrame:FindFirstChild("EquippedLabel") or inventoryFrame.GadgetsFrame:FindFirstChild("EquippedLabel")
print(player.Name.." equipped gadget "..button.Name)
equippedLabel.Parent = inventoryFrame
equippedLabel.Size = button.Size
equippedLabel.Position = button.Position
equippedLabel.Visible = true
gadgetsFrame.GadgetEquipped:FireServer(button)
end)
end
end)
Is button the bigger square box or is it the rectangular shape? I’m asking as it seems to be taking the position of that rectangular box instead of the square
Instead of moving it with a script you place it where and how you want and just change visibility. could that work for you. like when you equip it makes the word equipped visible and when you equip something else it makes what’s equipped not visible and what your equipping visible. sorry if explanation is bad.
Okay so I was testing stuff out, so see if this works. Your CellSize will need to use scale, and so will your equippedLabel. Also, I’m not sure exactly how your frames are working, but when testing I had my frame be the whole cell, and then parented the “Label” to that frame.
I found out the solution! Basically instead of setting the EquippedLabel position, I parented it to the ImageButton and resized it so it could move with it, and made it visible if that button was clicked.