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

How do I make a GUI appear when a player is in range?

I'm making batman!

And I want the player to be able to grapple to some specific bricks when they get close enough to them by pressing a button. Think the grapple mechanic in the Arkham games, but more limited.

I want to have an indicator GUI appear when a player is in range of a brick they can grapple onto which will point them to the direction of the brick and demonstrate where it is--again, think Arkham. How would I do that?

2 answers

✓ Accepted answer

In a LocalScript in StarterGui:

local player = game.Players.LocalPlayer
local char = player.Character
if(char.Torso.Position - game.Workspace.Part.Position).Magnitude <= 10 then
	print("Character is 10 or less studs away from part")
end

3 comments

0

I don't see the reason for a print.

0

It is just an example, instead of the print do the gui.Visible = true, and do an else and do gui.Visible = false

0

Can you please accept this answer?

What you can do is just set parts in certain points and create onTouched function to get the GUI to pop up

Example:

GUI = game.Players.LocalPlayer.PlayerGui.GUINAME

script.Parent.Touched:connect(function()
              if GUI.Visible == false then
                         GUI.Visible =true 
           wait(5)
                  GUI.Visible = false
          end
end)

This was done on a phone so it is not sorted with tabs but instead sorted with spaces please rearrange the code

Please be Sure to ACCEPT this answer :)

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