So basically, I need a GUI to pop up on the screen(its for ammo) when I equip my gun! I tried to put a ScreenGUI with frames and stuff inside the Handle of the gun... it does not show up when I grab the gun. I have looked at free models and the screengui is just inside the tool. I wish to make it like this... I tried to do a script where the screen gui is enabled when I equip the tool, it did not work. -- The big part is.. I need a GUI to pop up when I equip a tool, and the GUI must be able to be changed as values within the tool's local script is changed. Thank you!!!
So to have a function on a tool (your gun) being equipped you would have to use Tool:Equipped.
So in order to use this, first you need to set up a local way of getting to your gun and your player. Therefore I recommend putting the script in the GUI for the ammo.
local gui = script.Parent local player = script.Parent.Parent local tool = player.Backpack:WaitForChild("Gun") --Or if you have other ways of getting to the gun
Now you have your'e local's you can access the gun and function when its equipped like this:
local gui = script.Parent local player = script.Parent.Parent local Tool = player.Backpack:WaitForChild("Gun") --Or if you have other ways of getting to the gun Tool.Equipped:connect(function(mouse) gui.Enabled = true end)
And if you want to make it disappear when its unequipped you can make another function after the end using Tool:Unequipped. Using the wiki page here and the current script you could figure out what you need to do.
im not familar at all with tools but probably something like
if gun.beingheld = true then -- not sure what the correct term is for beingheld ammogui.Visible = true if gun.beingheld = false then ammogui.Visible = false