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

How do I pair a HopperBin with a ScreenGui?

I'm making a little tool for administrative fun, and I need a ScreenGui that I've made to appear whenever the tool is selected, and be removed whenever the tool is deselected. Is there an easy way to do this? Other than cloning the ScreenGui over from the Tool?

1 answer

✓ Accepted answer

Hopperbins are pretty much outdated, and idk if they would work, but I could give you some information. There is a selected and deselected event. I will give you an example code of how it would work, but It may not be for your exact hopperbin. Unfortunately, you cannot "pair" a screen gui with a hopper bin without scripting it or cloning a precreated one. Here is an easy way to clone a screen gui to the player then remove it.

bin = Script.Parent
gui = bin.ScreenGui
guicloned = nil -- this is the cloned gui
bin.Selected:connect(function(mouse)
	guicloned = gui:Clone()
	guicloned.Parent = game.Players.LocalPlayer.PlayerGui
end)
bin.Deselected:connect(function()
	if guicloned~=nil then
		guicloned:Destroy()
	end
	guicloned = nil
end)

bin is the hopperbin gui is the gui you want cloned Creating a separate variable for the cloned gui is a great idea so you can easily remove it

1 comment

0

I've changed my mind, and decided to activate the tool through chat commands, but thanks anyways!

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