Hi devs, I was trying to make a select sword GUI, so I did a script if you click on a sword, it show its infos and if you click equip it should take the imagelabel of the sword and cloning it in the inventory frame, how can I do this? I tried with ImageLabel:Clone() and changing his parent to the inventory frame but it is not working, how can I do this? Thank you.
Show us your code please, it will helps us to help you
script.Parent.MouseButton1Click:Connect(function(SwordInInventory)
script.Parent.Parent.Image:Clone()
script.Parent.Parent.Parent.Sword1.Parent = script.Parent.Parent.Parent.Parent.Parent.Parent.Backpack.Slot1
end)
Maybe I did a stupid thing
First thing to know, Guis should be parented to PlayerGui if it is a ScreenGui. Something like Billboard or SurfaceGui should be parented to a part. Instead of parenting it to the Backpack, change it with PlayerGui and try again
There are not Billboards, it is a screengui
That’s it, ScreenGui should be parented to PlayerGui
And? What do I need to do? I was changing the ImageLabel parent.
script.Parent.Parent.Image:Clone().Parent = THE_LOCATION
imageLabel:Clone().Parent = NewFrame -- Replace image label with the real label and replace newframe with the real frame.
Try this code:
local button = script.Parent
local player = game.Players.LocalPlayer
button.MouseButton1Click:Connect(function()
button.Parent.Image:Clone().Parent = player.PlayerGui.Slot1
end)
It is not working for me, and there is nothing in the output
i will never be able to do a correcte code bloc quote, damn
show us the hierarchiy of the explorer
Nothing seems working, I tried your script and this is the output error:
Players.LuigiMinecraft03.PlayerGui.Backpack.MainMenu.All.AllMenu.Sword1.TextButton.Script:7: attempt to call a nil value
So what you want to clone is the imagelabel named Sword1?
Yes that’s what I want to do, cloning it into Slot1 frame
Alright, with the hierarchy it is a bit more clear thanks, wait a min.
Alright, here we go, i think i did no mistake:
local button = script.Parent
local player = game.Players.LocalPlayerbutton.MouseButton1Click:Connect(function()
button.Parent:Clone().Parent = player.PlayerGui:WaitForChild(“Backpack”):WaitForChild(“Backpack”).Inventory.Slot1
end)
Players.LuigiMinecraft03.PlayerGui.Backpack.MainMenu.All.AllMenu.Sword1.TextButton.Script:6: attempt to index nil with ‘PlayerGui’