tech/game

21/07/28 How to Make a Shop Menu GUI [Updated Version] - Roblox Studio Tutorial

tech-lover 2021. 7. 28. 20:04

https://youtu.be/tbCHsxR1UWE

 

- game.SterterGui.ScreenGui.Shop.LocalScript

 

```

local open = game.Workspace.openShop

local close = game.Workspace.closeShop

local frame = script.Parent

local closeButton = frame.closeButton

 

frame.Visible = false



local function shopMenu(hit)

    local player = game.Players:FindFirstChild(hit.Parent.Name)

    

    if player and player.PlayerGui.ScreenGui.Shop.Visible == false then

        --print(player)

        player.PlayerGui.ScreenGui.Shop.Visible = true

        player.Character.Humanoid.WalkSpeed = 0

 

    end 

end

 

local function closeMenu()

    local player = game.Players.LocalPlayer

    

    if player and player.PlayerGui.ScreenGui.Shop.Visible == true then

        --print(player)

        player.PlayerGui.ScreenGui.Shop.Visible = false

        player.Character.HumanoidRootPart.Orientation = close.Orientation

        player.Character.HumanoidRootPart.CFrame = CFrame.new(close.Position.X, close.Position.Y+1, close.Position.Z)

        player.Character.Humanoid.WalkSpeed = 16

    end 

end



open.Touched:Connect(shopMenu)

closeButton.MouseButton1Click:Connect(closeMenu)

```