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

GUI Pop-Up [closed]

Asked by 11 years ago

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?

Locked by FearMeIAmLag and BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

2 answers

Log in to vote
5
Answered by
MrNicNac 855 Moderation Voter
11 years ago

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

01local toolname = "Sword" -- What they should be holding when stepping on the part
02 
03script.Parent.Touched:connect( function(hit)
04    if hit.Parent then
05        local player = Game.Players:GetPlayerFromCharacter(hit.Parent)
06        if player then
07            if player.Character:FindFirstChild(toolname) then
08                -- make the GUI show
09                -- try putting the GUI you want to show up in ReplicatedStorage then inserting it into the player's PlayerGui here
10            end
11        end
12    end
13end)
1
You might also include a check to make sure that child is actually a tool. Bubby4j 231 — 11y
Ad
Log in to vote
0
Answered by 10 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

Try this

01function onTouch()
02Tool  = game.Starterpack.Toolname --Change toolname to the name of the tool
03if Tool.Equipped == true then
04if Player.Touched == true then
05if guiname.Visible == false then -- replace guiname with the name of the gui
06wait(0.5)
07guiname.Visible = true
08end
09onTouch:connect
10end
11onTouch()