Проблема в том, что настройки кривые, там просто сами настройки вылезают за менюшку настроек и текст залезает на кнопки и короче пипец
-- CoinDisplayManager с исправленными настройками и иконками
-- Получаем сервисы
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local SoundService = game:GetService("SoundService")
local ContentProvider = game:GetService("ContentProvider")
local RunService = game:GetService("RunService")
-- Получаем локального игрока и его GUI
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
-- Константы для интерфейса
local HUD_CONTAINER_TOP_MARGIN = 20
local HUD_CONTAINER_PADDING_BETWEEN_ITEMS = 15
local FRAME_HEIGHT = 50
local FRAME_BACKGROUND_COLOR = Color3.fromRGB(40, 40, 50)
local FRAME_CORNER_RADIUS = 25
local FRAME_HORIZONTAL_PADDING = 20
local FRAME_VERTICAL_PADDING = 10
local PADDING_BETWEEN_ELEMENTS = 15
local ICON_SIZE = FRAME_HEIGHT - (2 * FRAME_VERTICAL_PADDING)
local ICON_HOVER_SCALE = 1.2
local TEXT_FONT = Enum.Font.SourceSansBold
local TEXT_COLOR = Color3.fromRGB(255, 255, 255)
local MIN_TEXT_WIDTH = 50
-- Константы для Gear Icon
local GEAR_ICON_TOP_MARGIN = HUD_CONTAINER_TOP_MARGIN
local GEAR_ICON_RIGHT_MARGIN = 20
local GEAR_ICON_SIZE_ABSOLUTE = 45
local GEAR_ICON_CORNER_RADIUS = 12
local GEAR_ICON_HOVER_SCALE = 1.15
local GEAR_ICON_BACKGROUND_COLOR = Color3.fromRGB(40, 40, 50)
local GEAR_ICON_IMAGE_COLOR = Color3.fromRGB(255, 255, 255)
local GEAR_ICON_STROKE_COLOR = Color3.fromRGB(60, 60, 70)
local GEAR_ICON_STROKE_THICKNESS = 2
-- Функция для получения текстуры из модели
local function getTextureFromModel(modelName)
local iconsPack = Workspace:WaitForChild("ICON PACK GOOD")
local model = iconsPack:WaitForChild(modelName)
code
-- Ищем Decal или Texture в модели
for _, child in pairs(model:GetDescendants()) do
if child:IsA("Decal") or child:IsA("Texture") then
return child.Texture
elseif child:IsA("SurfaceGui") then
for _, guiChild in pairs(child:GetDescendants()) do
if guiChild:IsA("ImageLabel") or guiChild:IsA("ImageButton") then
return guiChild.Image
end
end
end
end
-- Если не нашли текстуру, возвращаем стандартную
return "rbxasset://textures/ui/GuiImagePlaceholder.png"
end
-- Получаем иконки из моделей
local COIN_ICON = getTextureFromModel("Coin")
local ZVEZDA_ICON = getTextureFromModel("Zvezda")
local GEAR_ICON = getTextureFromModel("Gear")
-- Создаём опции настроек строго по образцу из скриншота
local function createOption(order, text)
local option = Instance.new("Frame")
option.Name = "Option" .. order
option.Size = UDim2.new(1, 0, 0, 45)
option.BackgroundColor3 = Color3.fromRGB(65, 115, 195)
option.Parent = settingsContainer
code
local optionCorner = Instance.new("UICorner")
optionCorner.CornerRadius = UDim.new(0, 10)
optionCorner.Parent = option
local textLabel = Instance.new("TextLabel")
textLabel.BackgroundTransparency = 1
textLabel.Position = UDim2.new(0, 15, 0, 0)
textLabel.Size = UDim2.new(0.6, 0, 1, 0)
textLabel.Font = Enum.Font.GothamSemibold
textLabel.Text = text
textLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
textLabel.TextSize = 16
textLabel.TextXAlignment = Enum.TextXAlignment.Left
textLabel.TextYAlignment = Enum.TextYAlignment.Center
textLabel.Parent = option
local button = Instance.new("TextButton")
button.AnchorPoint = Vector2.new(1, 0.5)
button.Position = UDim2.new(1, -15, 0.5, 0)
button.Size = UDim2.new(0, 60, 0, 30)
button.BackgroundColor3 = Color3.fromRGB(80, 200, 80)
button.Text = "Да"
button.TextColor3 = Color3.fromRGB(255, 255, 255)
button.Font = Enum.Font.GothamBold
button.TextSize = 18
button.Parent = option
local buttonCorner = Instance.new("UICorner")
buttonCorner.CornerRadius = UDim.new(0, 8)
buttonCorner.Parent = button
local isOn = true
button.MouseButton1Click:Connect(function()
isOn = not isOn
if isOn then
button.BackgroundColor3 = Color3.fromRGB(80, 200, 80)
button.Text = "Да"
else
button.BackgroundColor3 = Color3.fromRGB(200, 80, 80)
button.Text = "Нет"
end
-- Применяем настройки
if order == 1 then -- Музыка
Settings.MusicEnabled = isOn
for _, sound in pairs(SoundService:GetDescendants()) do
if sound:IsA("Sound") and sound.Name:lower():find("music") then
sound.Playing = isOn
end
end
elseif order == 2 then -- Звуковые эффекты
Settings.SoundEffectsEnabled = isOn
for _, sound in pairs(SoundService:GetDescendants()) do
if sound:IsA("Sound") and not sound.Name:lower():find("music") then
sound.Playing = isOn
end
end
elseif order == 3 then -- Питомцы других игроков
Settings.ViewOtherPets = isOn
elseif order == 4 then -- Свои питомцы
Settings.ViewOwnPets = isOn
end
end)
return option
end
-- Создаём настройки в нужном порядке
createOption(1, "Музыка:")
createOption(2, "Звуковые эффекты:")
createOption(3, "Посмотреть других питомцев:")
createOption(4, "Посмотрите на своих питомцев:")
-- Обработчики событий
gearIcon.MouseButton1Click:Connect(function()
settingsMenu.Visible = not settingsMenu.Visible
if settingsMenu.Visible then
-- Анимация появления
settingsMenu.Size = UDim2.new(0, 0, 0, 0)
TweenService:Create(settingsMenu, TweenInfo.new(0.3, Enum.EasingStyle.Back), {Size = UDim2.new(0, 350, 0, 240)}):Play()
end
end)
-- Функция безопасного получения лидерстатов
local function safeGetLeaderstat(statName, defaultValue)
local leaderstats = LocalPlayer:FindFirstChild("leaderstats")
if not leaderstats then
return {
Value = defaultValue or 0,
Changed = Instance.new("BindableEvent").Event
}
end
code
local stat = leaderstats:FindFirstChild(statName)
if not stat then
return {
Value = defaultValue or 0,
Changed = Instance.new("BindableEvent").Event
}
end
return stat
end
-- Обновление отображения валют
local function updateCurrency(statName, label)
local stat = safeGetLeaderstat(statName)
if stat.Changed then
stat.Changed:Connect(function(value)
label.Text = tostring(value)
end)
label.Text = tostring(stat.Value)
end
end
-- Обработчик для обнаружения новых leaderstats
LocalPlayer.ChildAdded:Connect(function(child)
if child.Name == "leaderstats" then
print("Leaderstats обнаружены, обновляем интерфейс...")
code
-- Монеты
local newCoinsStat = child:FindFirstChild("Coins")
if newCoinsStat then
newCoinsStat.Changed:Connect(function(value)
coinCountLabel.Text = tostring(value)
end)
coinCountLabel.Text = tostring(newCoinsStat.Value)
end
-- Звезды
local newStarsStat = child:FindFirstChild("Stars")
if newStarsStat then
starFrame.Visible = true
newStarsStat.Changed:Connect(function(value)
starCountLabel.Text = tostring(value)
end)
starCountLabel.Text = tostring(newStarsStat.Value)
else
starFrame.Visible = false
end
end
end)
-- Эффекты наведения для кнопки настроек
local originalGearSize = gearIcon.Size
local hoverGearSize = UDim2.new(0, GEAR_ICON_SIZE_ABSOLUTE * GEAR_ICON_HOVER_SCALE, 0, GEAR_ICON_SIZE_ABSOLUTE * GEAR_ICON_HOVER_SCALE)
local gearTweenInfo = TweenInfo.new(0.2, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local function createOption(order, text)
local option = Instance.new("Frame")
option.Name = "Option"..order
option.Size = UDim2.new(1,0,0,45)
option.BackgroundColor3 = Color3.fromRGB(65,115,195)
option.LayoutOrder = order -- чтобы UIListLayout понимал порядок
option.Parent = settingsContainer
-- …
-- Текст заполняет всё, кроме места под кнопку (+30 px запас)
textLabel.Size = UDim2.new(1,-90,1,0) -- 90 = 60 кнопка + 30 отступ
-- …
end
Анимация открытия теперь простая – мы знаем только ширину:
lua
gearIcon.MouseButton1Click:Connect(function()
settingsMenu.Visible = not settingsMenu.Visible
if settingsMenu.Visible then
settingsMenu.Size = UDim2.new(0,350,0,0) -- свернули по Y
TweenService:Create(settingsMenu,
TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out),
{Size = UDim2.new(0,350,0,settingsMenu.AbsoluteSize.Y)}
):Play()
end
end)
• Если шрифт иногда не помещается внутри 90 px, включи TextWrapped = true или TextScaled = true.
• Для мобильных можно добавить UIScale в SettingsMenu (Scale = 0.8, например).
• Если пунктов станет много, оберни settingsContainer в ScrollingFrame – тогда ничего не вылезет даже на маленьких экранах.
Попробуй “правильный” вариант – и настройки больше не будут «пипец» 😉