TouchPart Shop not working

So I was trying to make a shop that opens when you touch a part, at first I tried using a local script in StarterGui…

image
but using a local script the shop opens before I touch the part, and sometimes it opens alone, when I’m far from the part

so I changed to a normal script, It works well, but when I close the shop, it doesn’t opens anymore :frowning: (I really need help)

1 Like

Fire a remote event to a local script. The local script should make the frame visible, since doing it on the server will make it happen on everyone who is in game.

Already did that, but I want to fix the gui opening, it opens everytime withou I even touching :confused:

It will fire when anything touches it. Including other parts.

Edit: To solve it, have a part that detects if the hit.Parent is the player.

Thats because you need to check whether the part is being touched by a player instead of another part. This can be easily achieved by an if statement checking for a humanoid:

if hit.Parent:FindFirstChild("Humanoid") then
      --rest of code
end
1 Like

Worked, thanks a lot, I’m new at scripting and this forum are helping me a lot :slight_smile:
thx man!

1 Like