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

How would I make a frame visible when you hold a tool and when you put the tool back it's invisible?

I want to hold out a toll and make a frame visible on my scree, and when I take the tool out the frame will go away, how would i do that?

1 answer

✓ Accepted answer

This can be achieved by using two events which would be Tool.Equipped and Tool.Unequipped.

By using these events you can detect when a player equips a specific tool and when they unequip that tool.

Insert a Local Script into your tool and use the following code:

local Tool = script.Parent
local Player = game.Players.LocalPlayer

Tool.Equipped:Connect(function()
	-- Here you will need to locate the frame you want to make visible.
	Player.PlayerGui.ScreenGui.Frame.Visible = true
end)

Tool.Unequipped:Connect(function()
	Player.PlayerGui.ScreenGui.Frame.Visible = false
end)

Links: Tool.Equipped, Tool.Unequipped

Hope this helps.

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