How to make a ui pop up when you touch a group?

So, i got a shop which when you touch the group, a ui pops up, and i don’t know how to script much, lol. So, can you help me please? I’ve got an exit button already.

1 Like

Is it a group of parts? If it is, consider making only one part that is invisible and can collide off to be the detector then add this script

-- Put this in a script in the part that is the detector
script.Parent.Touched:Connect(function(plr)
	game.ReplicatedStorage.OpenStoreGUI:FireClient(plr)
end)

Example of remote event setup:
OpenStoreGUI

If you want it to open a UI on the player’s side you can fire a remote event to the player and tell a local script to show the GUI
Example of gui setup:
Gui Example

-- Put a local script in starter GUI and make it show the UI you want when it gets the remote event

game.ReplicatedStorage.OpenStoreGUI.OnClientEvent:Connect(function()
	script.Parent.EXAMPLEGUI.Frame.Visible  = true
end)
1 Like

I don’t think the remote event is necessary it could be shortened to 1 local script

-- Put this in a script in the part that is the detector
script.Parent.Touched:Connect(function(plr)
     if plr:FindFirstChild("Humanoid") then
	   game:GetService("StarterGui").ExampleGui.Enabled = true -- disable the example gui :)
   end
end)

Also yours wouldn’t work cuz you didn’t check if plr was a player and even if I think it would show to everyone (not trying to sound mean btw)

1 Like

Doesn’t work. Anything else? :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Where are u put the script? Also where is da gui?

the script is on the detector, and the gui is in the middle. (In the frame, there are many stuff in it, btw)

No like is the gui in starter gui? And also change

to the name of your gui

Edit: Also you might have frame invisible so try

-- Put this in a script in the part that is the detector
script.Parent.Touched:Connect(function(plr)
     if plr:FindFirstChild("Humanoid") then
	   game:GetService("StarterGui").ExampleGui.Frame.Visible = true
   end
end)

Still doesn’t work. I have spelled everything right.

Mmmmm thats weird can you show a screenshot of your studio so I know where is where cuz right now am kinda guessing also do you have any errors?

EDIT: OH I KNOW WHY SORRY NEW CODE

-- Put this in a script in the part that is the detector
script.Parent.Touched:Connect(function(part)
     if part.Parent:FindFirstChild("Humanoid") then
	   game:GetService("StarterGui").ExampleGui.Frame.Visible = true
   end
end)

I would suggest going with @jsnotlout1’s solution, @R41NB0W4C3’s solution is not efficient and will most likely bug a lot.

1 Like

Still doesnt work. :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Oh then I don’t really know sorry

Btw if this is in a group then it should be in a detector but else idk sorry about that

Doesn’t work… :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Yeah I forgot that part. Check if the thing that collided was the player not just a random part

--//Services
local Players = game:GetService("Players")

--//Functions
script.Parent.Touched:Connect(function(hitpart)
     local Humanoid = hitpart.Parent:FindFirstChild("Humanoid")
     if Humanoid then
	   local Player = Players:GetPlayerFromCharacter(hitpart.Parent)
       Player.PlayerGui.MyScreenGui.Enabled = true
   end
end)

Also, if you can’t make it work by yourself, send me your StarterGui layout so I can make the code fit your needs.

https://watch.screencastify.com/v/eIhcO3Ky4ojYPuUXIxKN

This is my StarterGui. I had to record it lol.

Which gui do you want to appear when they touch the group?

RebirthGUI. :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Here you go! This should work for you now.

--//Services
local Players = game:GetService("Players")

--//Functions
script.Parent.Touched:Connect(function(hitpart)
     local Humanoid = hitpart.Parent:FindFirstChild("Humanoid")
     if Humanoid then
	   local Player = Players:GetPlayerFromCharacter(hitpart.Parent)
       Player.PlayerGui.RebirthGUI.Enabled = true
   end
end)
1 Like