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

how do you make a script that makes a gui appear when you hold a tool?

as shown in the title, i need help with this script, i tried a bit but they all failed, anyone able ot help out

3 comments

1

Post the script here, we will not script stuff for you as this is not a request site.

1

But, use the :Equipped function on the tool script.

0

sorry, ill post it next time

1 answer

I put a local script inside of the tool and wrote this.

script.Parent.Equipped:Connect(function() --// When the player equips the tools, the events will fire
	local player = game:GetService("Players").LocalPlayer --// Finds the player
	if player then --// Checks if the player is valid
		local targGui = player:WaitForChild("PlayerGui"):FindFirstChild("PUT THE NAME OF THE GUI YOU WANT HERE") --// Finds the targeted gui
		if targGui then --// Checks if the gui is valid
			targGui.Enabled = true --// Enables the gui
		end
	end
end)

script.Parent.Unequipped:Connect(function() --// When the player unequips the tool, the events will fire
	local player = game:GetService("Players").LocalPlayer --// Finds the player
	if player then --// Checks if the player is valid
		local targGui = player:WaitForChild("PlayerGui"):FindFirstChild("PUT THE NAME OF THE GUI YOU WANT HERE") --// Finds the targeted gui
		if targGui then --// Checks if the gui is valid
			targGui.Enabled = false --// Disables the gui
		end
	end
end)

Make sure you change the name of the targeted gui where it says PUT THE NAME OF THE GUI YOU WANT HERE

Also make sure you have your gui disabled in starter gui and reset on respawn is enabled.

Hope this helped, if it didn't work let me know so I can fix it for you.

Remember: This is not a request site.

2 comments

0

I Upvoted Your Post And Replys As You Are Correct This Is NOT A Request Site And This Script Is Helpful For Others.

1

Thank you!

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