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

GUI Pop-Up

I’m having difficulty creating a script, where if you walk onto a certain part, holding an item, a GUI will pop up. Anybody able to help me?

2 answers

✓ Accepted answer

Assuming "holding an item" means "with a tool equipped" then you can do this (putting the script in the part they walk on)

local toolname = "Sword" -- What they should be holding when stepping on the part

script.Parent.Touched:connect( function(hit)
	if hit.Parent then
		local player = Game.Players:GetPlayerFromCharacter(hit.Parent)
		if player then
			if player.Character:FindFirstChild(toolname) then
				-- make the GUI show 
				-- try putting the GUI you want to show up in ReplicatedStorage then inserting it into the player's PlayerGui here
			end
		end
	end
end)

1 comment

1

You might also include a check to make sure that child is actually a tool.

Try this

function onTouch()
Tool  = game.Starterpack.Toolname --Change toolname to the name of the tool
if Tool.Equipped == true then
if Player.Touched == true then
if guiname.Visible == false then -- replace guiname with the name of the gui
wait(0.5)
guiname.Visible = true
end
onTouch:connect
end
onTouch()

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