Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Open Shop Using Part as Sensor?

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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.

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

Answer this question