How to make a shop Gui with button hover effect! Roblox studio lite

Опубликовано: 23 Июль 2026
на канале: OfficialPandaGamer
6,030
122

Script here:


-- References to the GUI elements
local Gui = script.Parent -- Assuming the button that opens/closes the shop is the parent of this script
local ShopGui = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("ShopGui"):WaitForChild("ShopFrame") -- The actual ShopGui that will be toggled

-- Variables for scaling the button
local OriginalSize = Gui.Size
local ScaleFactor = 1.15 -- How much the button should scale up (adjustable)
local TweenTime = 0.1 -- How quickly the scale transition happens
local isOpen = false -- Tracks whether the shop is open or closed

-- Function to scale the button up when mouse hovers over it
local function ScaleUp()
local NewSize = UDim2.new(OriginalSize.X.Scale, OriginalSize.X.Offset * ScaleFactor, OriginalSize.Y.Scale, OriginalSize.Y.Offset * ScaleFactor)
game:GetService("TweenService"):Create(Gui, TweenInfo.new(TweenTime), {Size = NewSize}):Play()
end

-- Function to scale the button down when mouse leaves
local function ScaleDown()
game:GetService("TweenService"):Create(Gui, TweenInfo.new(TweenTime), {Size = OriginalSize}):Play()
end

-- Function to toggle the ShopGui visibility (open/close the shop)
local function toggleShopGui()
isOpen = not isOpen -- Toggle the isOpen variable
ShopGui.Visible = isOpen -- Show or hide the ShopGui based on the value of isOpen
end

-- Connect the mouse hover events to scale the button
Gui.MouseEnter:Connect(ScaleUp) -- Scales up the button when mouse enters
Gui.MouseLeave:Connect(ScaleDown) -- Scales down the button when mouse leaves

-- Connect the button click event to toggle the ShopGui
Gui.MouseButton1Click:Connect(toggleShopGui) -- Toggle the shop when clicked