Help with script - When player touches a part a gui appears

So when the player touches a part (in this case a floor tile), I want a gui that I made to pop up, however once the player has activated the gui it cannot make the gui appear again. so pretty much it only works once.
does anyone know how to do this?

1 Like

I’m assuming what you’re doing is you’re enabling the gui through the server then disabling through the client. Because the client changes don’t replicate to the server, it will only work the one time. You should either fire a remote from the server to have the gui become visible, or listen for the touch on the client.

I would rather use the client as I have heard using remotes isn’t the best option for things like this. However I do not know how to script it.

Touched events on the client are much simpler actually because you don’t need to verify a player.

    if not myGui.Frame.Visible then -- put everything in a frame and change `Visible` instead of the ScreenGui's `Enabled` property
        myGui.Frame.Visible = true
1 Like

ok, but won’t that make the gui appear and then if I touch the part again it makes the gui appear again?

Well yes, that is the point after all?

There is a conditional that will make the gui visible only if it isn’t already.

1 Like

I want it to appear once so how do I do that? Because when the player enters the room I want my gui that contains a typewriting effect to play once. I have no idea how to do so because I don’t usually use remotes and gui’s.

1 Like

Add a debounce value if you are controlling it locally. Set it to true once the GUI pops up and add a check to see if that value is true before giving it to them. So a BoolValue, probably put it inside the local script too.

1 Like

You can add a BoolValue and in the touched event change the value from something like false to true
If the touched event fires again you should check if the BoolValue is not equal to true and if so then the GUI didn’t appear yet and if not then the GUI was already triggered.

I don’t know how to script a debounce because I don’t usually script guis so I literally have no idea where to begin. I have created my gui with my typewriting however when it disappears I want it to appear again in the different room( when the player enters it).

Ok, but I have no idea how to do so because I don’t usually script guis.

	local Humanoid = Touch.Parent
	if Humanoid then
		local Debounce = script.Debounce.Value -- Debounce should be a Bool value located inside the script
		if not Debounce then
			script:WaitForChild("Debounce").Value = true
			-- Script

BoolValues have nothing to do with GUIs, they’re just instances which indicate an either true or false value.

You can basically detect if the player entered the new room and then reset the BoolValue.

Thank you for the script and suggestions but I don’t know where to begin. I will use @Tr0_p script but I am not sure how to use it correctly like where do I put it and what do i add? Sorry if I am learning slowly I don’t really do guis

If you are using a localscript (as you said you wanted to run this from the client), then this script will have to be put in StarterPlayerScripts or StarterGui as that is where Localscripts can run. Inside of that script, insert a BoolValue called “Debounce”. Set this value to true when the script begins then set it to false once the script finishes (assuming you want it to run again).

there are alot of different ways making the gui appear

  1. You can use .Touched and .TouchEnded (which is not recommended due to it’s bugginess)

  2. You can use Render Stepped and Magnitude (this is recommended)

  • Render Stepped is like .Touched but not buggy i guess, and magnitude the distance in studs before the gui dissapears,
  1. You can use Region3’s which i don’t recommend for your situation… I don’t know if they are the best because region3’s are through a server script and gui’s are never recommended to do on a server script…

RenderStepped and Magnitude Method (Recommended!)

  1. Make the gui/frame invisible
  2. Put the local script inside the gui/frame
  3. Make a triggerPart in workspace and make it invisible, anchored and uncollidable
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local rs = game:GetService("RunService")

		local guiFrame = script.Parent
		button.Visible = true

Region3 Method (not recommended)…

  1. Make a region part (like a hitbox for your whole trigger area)
  2. Put a normal script inside it
  3. Put this inside
local RegionPart = script.Parent
local pos1 = RegionPart.Position - (RegionPart.Size / 2)
local pos2 = RegionPart.Position + (RegionPart.Size / 2)
local region =, pos2) -- This calculates the corner 1 of the trigger area and 2 and makes it a region

while true do

	local partsInRegion = workspace:FindPartsInRegion3(region, nil, 1000)
	for i, part in pairs(partsInRegion) do
		if part.Parent:FindFirstChild("Humanoid") ~= nil then
			local char = part.Parent
			local player = game.Players:GetPlayerFromCharacter(char)
			if player then
                local gui = game.ReplicatedStorage.gui:Clone()
                gui.Parent = player.PlayerGui

The RenderStepped method is recommended and way easier, if i didn’t cover something just mention it because i got way into this as i was writing it…

If you wanna use the Region3 method, please just make sure you’re doing it correctly and knowing what you’re doing because there’s some bugs there aswell and are weird to patch so yeah, i recommend you the renderstepped method


1 Like

I feel as if that is massively overcomplicating it as he only wanted it to show once, correct me if I am wrong.


Oh in that case lemme edit the post, i didn’t see it

I thought he needed it to also dissapear, so Yeah you can use .Touched it works fine, my bad