-- 获取服务 local Players = game:GetService("Players") local PlayerGui = Players.LocalPlayer:WaitForChild("PlayerGui") -- 创建 ScreenGui 容器 local MainGui = Instance.new("ScreenGui") MainGui.Name = "RLGClickGUI" MainGui.Parent = PlayerGui MainGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling -- ====================== 主窗口背景 ====================== local MainFrame = Instance.new("Frame") MainFrame.Name = "MainFrame" MainFrame.Size = UDim2.new(0, 400, 0, 300) MainFrame.Position = UDim2.new(0.5, -200, 0.5, -150) MainFrame.BackgroundColor3 = Color3.new(0.15, 0.15, 0.18) MainFrame.BorderSizePixel = 2 MainFrame.BorderColor3 = Color3.new(0.4, 0.7, 1) MainFrame.Parent = MainGui -- 窗口标题文字 local TitleText = Instance.new("TextLabel") TitleText.Size = UDim2.new(1, 0, 0, 40) TitleText.BackgroundTransparency = 1 TitleText.Text = "RLG 可点击交互面板" TitleText.Font = Enum.Font.GothamBold TitleText.TextSize = 22 TitleText.TextColor3 = Color3.new(1, 1, 1) TitleText.Parent = MainFrame -- ====================== 点击按钮1:弹出提示 ====================== local ClickBtn1 = Instance.new("TextButton") ClickBtn1.Name = "PopTipBtn" ClickBtn1.Size = UDim2.new(0, 160, 0, 45) ClickBtn1.Position = UDim2.new(0.05, 0, 0.2, 0) ClickBtn1.BackgroundColor3 = Color3.new(0.2, 0.6, 1) ClickBtn1.Text = "点击弹出提示" ClickBtn1.Font = Enum.Font.Gotham ClickBtn1.TextSize = 16 ClickBtn1.TextColor3 = Color3.new(1,1,1) ClickBtn1.BorderSizePixel = 1 ClickBtn1.BorderColor3 = Color3.new(1,1,1) ClickBtn1.Parent = MainFrame -- ====================== 点击按钮2:变色反馈 ====================== local ClickBtn2 = Instance.new("TextButton") ClickBtn2.Name = "ColorBtn" ClickBtn2.Size = UDim2.new(0, 160, 0, 45) ClickBtn2.Position = UDim2.new(0.05, 0, 0.4, 0) ClickBtn2.BackgroundColor3 = Color3.new(0.8, 0.3, 0.4) ClickBtn2.Text = "点击切换颜色" ClickBtn2.Font = Enum.Font.Gotham ClickBtn2.TextSize = 16 ClickBtn2.TextColor3 = Color3.new(1,1,1) ClickBtn2.BorderSizePixel = 1 ClickBtn2.BorderColor3 = Color3.new(1,1,1) ClickBtn2.Parent = MainFrame -- ====================== 关闭GUI按钮 ====================== local CloseBtn = Instance.new("TextButton") CloseBtn.Name = "CloseGuiBtn" CloseBtn.Size = UDim2.new(0, 70, 0, 35) CloseBtn.Position = UDim2.new(1, -75, 0, 5) CloseBtn.BackgroundColor3 = Color3.new(0.9, 0.2, 0.2) CloseBtn.Text = "关闭" CloseBtn.Font = Enum.Font.GothamBold CloseBtn.TextSize = 14 CloseBtn.TextColor3 = Color3.new(1,1,1) CloseBtn.Parent = MainFrame -- ====================== 弹窗容器(默认隐藏) ====================== local PopFrame = Instance.new("Frame") PopFrame.Name = "PopupFrame" PopFrame.Size = UDim2.new(0, 260, 0, 140) PopFrame.Position = UDim2.new(0.5, -130, 0.5, -70) PopFrame.BackgroundColor3 = Color3.new(0.1,0.1,0.1) PopFrame.BorderSizePixel = 2 PopFrame.BorderColor3 = Color3.new(1, 0.8, 0.2) PopFrame.Visible = false PopFrame.Parent = MainGui local PopText = Instance.new("TextLabel") PopText.Size = UDim2.new(0.9,0,0,70) PopText.Position = UDim2.new(0.05,0,0.1,0) PopText.BackgroundTransparency = 1 PopText.Text = "你成功点击按钮!\nRLGGUI交互生效" PopText.TextSize = 18 PopText.TextColor3 = Color3.new(1,1,1) PopText.Font = Enum.Font.Gotham PopText.TextWrapped = true PopText.Parent = PopFrame local PopCloseBtn = Instance.new("TextButton") PopCloseBtn.Size = UDim2.new(0, 100, 0, 32) PopCloseBtn.Position = UDim2.new(0.5, -50, 0.75, 0) PopCloseBtn.BackgroundColor3 = Color3.new(0.3,0.7,0.3) PopCloseBtn.Text = "确认关闭弹窗" PopCloseBtn.TextSize = 14 PopCloseBtn.TextColor3 = Color3.new(1,1,1) PopCloseBtn.Font = Enum.Font.Gotham PopCloseBtn.Parent = PopFrame -- ====================== 按钮点击逻辑 ====================== -- 按钮1:打开弹窗 ClickBtn1.MouseButton1Click:Connect(function() PopFrame.Visible = true end) -- 弹窗关闭按钮 PopCloseBtn.MouseButton1Click:Connect(function() PopFrame.Visible = false end) -- 按钮2:切换自身颜色 local colorState = false ClickBtn2.MouseButton1Click:Connect(function() colorState = not colorState if colorState then ClickBtn2.BackgroundColor3 = Color3.new(0.3, 0.8, 0.5) else ClickBtn2.BackgroundColor3 = Color3.new(0.8, 0.3, 0.4) end end) -- 总关闭按钮:隐藏整个界面 CloseBtn.MouseButton1Click:Connect(function() MainFrame.Visible = false end) -- 额外:按键盘U重新打开界面 game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.U then MainFrame.Visible = true PopFrame.Visible = false end end)