Touch a part to open a GUI shop

Ya you’ll need to replace “Shop” with “script.Parent”

1 Like

This is still not working. I don’t know why

Does it return any errors in the Output? This works perfectly fine for me.

Also make sure it is Enabled. It looks greyed out but I can’t tell

It is enabled. And alr lemme check the output


idk if it’s any of this. I think this is the right stuff

One question, does the gui even appear if you set it to visible in studio?

1 Like

That looks like an error with the other script. Are you able to send your GUI as a file? I can test it and send back

I can. the shop part is called ShopButton. Give me one second to get it for you

ShopGUI.rbxm (12.3 KB)


This seems to work perfectly fine for me. I didn’t edit anything?

Perhaps the script is running before the Part has loaded. You could try:

local MainPart = workspace:WaitForChild("ShopButton")

Where do I put the local MainPart = workspace:WaitForChild("ShopButton") ?

Replace

local MainPart = workspace.ShopButton -- This is the Part that Opens the Shop

You probably don’t need any server code for that,

  • Have an invisible trigger block to open the shop connected with a .Touched
  • Start a loop every X seconds (or connect it to a runservice event, ur choice) that uses the Spatial Query API (the new region3 and no weird modulescripts needed) to tell if the player’s humanoid root part is no longer in the trigger

Yeah my script basically does this lol

Could it possibly be because I have the ShopButton in a group of other parts? I wonder if it needs to be by itself

Yup that’s what it was. I fixed it lol

If you have Multiple parts called ShopButton then it’d only select one. It needs to be named something Unique or you could use my Multiple Part option and just add all Parts named “ShopButton” into a table

As a thank you for helping me on this.

1 Like

Would recommend the following changes

  • RenderStepped should be replaced with Heartbeat
  • If the player doesn’t have a character or root part, it should probably just close the shop

possible problems:

  • RenderStepped event never disconnects when not needed
  • Magnitude functions as a sphere as opposed to a cylinder

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.