Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I pair a HopperBin with a ScreenGui?

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago

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

0
I've changed my mind, and decided to activate the tool through chat commands, but thanks anyways! BloodyBooger 20 — 9y
Ad

Answer this question