Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to Open Shop Using Part as Sensor?

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.

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.

4 comments

0

yes, i was wondering how i would make it close if they left the part

0

@Gabe_elvin1226aclan yes, i was wondering how i would make it close if they left the part

0

You use .TouchEnded instead of .Touched, I'll edit the message and you can copy

0

thank you

This discussion is preserved as it was. New answers, comments, and votes are closed.