I have been creating a simulator, and I was wondering how to open a shop screen gui that includes a scrolling frame by walking into a part that acts as a sensor. I have already created a sell part, so I duplicated it, and I'm trying to change the script to make it work as a shop.
✓ ANSWER ACCEPTED
How to Open Shop Using Part as Sensor?
1 answer
✓ Accepted answer
Ok so, I'll get you here the script, but make sure to insert a Script inside the part to where you want to be touched and get the gui.
local part = script.Parent
game.Players.PlayerAdded:Connect(function(player)
part.TouchEnded:Connect(function(hit)
if hit.Parent:FindFirstChild("HumanoidRootPart") then -- If a player
player.PlayerGui.GuiName:WaitForChild("ScrollingFrameName").Visible = false
end
end)
end)
If you want that the ScrollingFrame must be closed when a person doesn't touch the part anymore, comment back. Ignore if you already have a close button.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
yes, i was wondering how i would make it close if they left the part
@Gabe_elvin1226aclan yes, i was wondering how i would make it close if they left the part
You use .TouchEnded instead of .Touched, I'll edit the message and you can copy
thank you