Gexemy

Untitled

Aug 26th, 2025
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.67 KB | Help | 0 0
  1. --!strict
  2. local Players = game:GetService("Players")
  3. local RS = game:GetService("RunService")
  4. local UIS = game:GetService("UserInputService")
  5. local GuiService = game:GetService("GuiService")
  6. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  7. local OS_OVERRIDE_ATTR = "FlexOSOverride"
  8.  
  9. local LP = Players.LocalPlayer
  10. local RE: RemoteEvent = ReplicatedStorage:WaitForChild("FlexStats") :: RemoteEvent
  11.  
  12. local function detectDeviceAndOS(): (string,string)
  13.     local override = LP:GetAttribute(OS_OVERRIDE_ATTR)
  14.     if typeof(override) == "string" and #override > 0 then
  15.         local isConsole = GuiService:IsTenFootInterface()
  16.         local device = isConsole and "Console" or ((UIS.TouchEnabled and not UIS.KeyboardEnabled) and "Mobile" or "PC")
  17.         if UIS.GamepadEnabled then device ..= "+Gamepad" end
  18.         return device, override
  19.     end
  20.  
  21.     local isConsole = GuiService:IsTenFootInterface()
  22.     local device = isConsole and "Console" or ((UIS.TouchEnabled and not UIS.KeyboardEnabled) and "Mobile" or "PC")
  23.     if UIS.GamepadEnabled then device ..= "+Gamepad" end
  24.  
  25.     local v = version()
  26.     local osName = "Unknown"
  27.  
  28.     if isConsole then
  29.         osName = "Console"
  30.     elseif UIS.TouchEnabled and not UIS.KeyboardEnabled then
  31.         if string.find(v, "Android") then
  32.             osName = "Android"
  33.         elseif string.find(v, "iOS") or string.find(v, "iPhone") or string.find(v, "iPad") then
  34.             osName = "iOS"
  35.         end
  36.     else
  37.         if string.find(v, "Windows") then
  38.             osName = "Windows"
  39.         elseif string.find(v, "Linux") or string.find(v, "Ubuntu") then
  40.             osName = "Linux"
  41.         elseif string.find(v, "Mac") or string.find(v, "OSX") then
  42.             osName = "macOS"
  43.         end
  44.     end
  45.  
  46.     return device, osName
  47. end
  48.  
  49. local DEVICE, OSSTR = detectDeviceAndOS()
  50. print("Detected:", DEVICE, OSSTR)
  51.  
  52. local function getResolution(): string
  53.     local cam = workspace.CurrentCamera
  54.     if cam then
  55.         local v = cam.ViewportSize
  56.         return string.format("%dx%d", v.X, v.Y)
  57.     end
  58.     return "0x0"
  59. end
  60.  
  61. local fps, smooth = 60, 0.15
  62. RS.Heartbeat:Connect(function(dt)
  63.     local inst = 1/math.max(dt, 1/240)
  64.     fps = fps + (inst - fps)*smooth
  65. end)
  66.  
  67. local function fpsColor(f:number): Color3
  68.     if f>=180 then return Color3.fromRGB(120,255,120)
  69.     elseif f>=60 then return Color3.fromRGB(170,255,120)
  70.     elseif f>=45 then return Color3.fromRGB(255,255,120)
  71.     elseif f>=25 then return Color3.fromRGB(255,200,120)
  72.     else return Color3.fromRGB(255,120,120) end
  73. end
  74.  
  75. local function makeBillboard(): BillboardGui
  76.     local bb = Instance.new("BillboardGui")
  77.     bb.Size = UDim2.fromOffset(200, 42)
  78.     bb.AlwaysOnTop = true
  79.     bb.LightInfluence = 0
  80.     bb.MaxDistance = 250
  81.     local tl = Instance.new("TextLabel")
  82.     tl.Name = "FlexLabel"
  83.     tl.BackgroundTransparency = 1
  84.     tl.Size = UDim2.fromScale(1,1)
  85.     tl.Font = Enum.Font.GothamBold
  86.     tl.TextScaled = true
  87.     tl.TextStrokeTransparency = 0.3
  88.     tl.TextStrokeColor3 = Color3.new()
  89.     tl.TextColor3 = Color3.new(1,1,1)
  90.     tl.Text = "..."
  91.     tl.Parent = bb
  92.     return bb
  93. end
  94.  
  95. local function addDonatorTag(bb: BillboardGui)
  96.     if bb:FindFirstChild("DonatorLabel") then return end
  97.     local dl = Instance.new("TextLabel")
  98.     dl.Name = "DonatorLabel"
  99.     dl.BackgroundTransparency = 1
  100.     dl.Size = UDim2.new(1,0,0.5,0)
  101.     dl.Position = UDim2.new(0,0,-0.6,0)
  102.     dl.Font = Enum.Font.GothamBold
  103.     dl.TextScaled = true
  104.     dl.Text = "DONATOR"
  105.     dl.TextStrokeTransparency = 0.2
  106.     dl.TextStrokeColor3 = Color3.new(0,0,0)
  107.     dl.Parent = bb
  108.     local grad = Instance.new("UIGradient")
  109.     grad.Color = ColorSequence.new({
  110.         ColorSequenceKeypoint.new(0, Color3.fromRGB(255,220,100)),
  111.         ColorSequenceKeypoint.new(1, Color3.fromRGB(100,255,120)),
  112.     })
  113.     grad.Rotation = 0
  114.     grad.Parent = dl
  115.     task.spawn(function()
  116.         while dl.Parent do
  117.             for i = 0, 360, 2 do
  118.                 grad.Rotation = i
  119.                 task.wait(0.05)
  120.             end
  121.         end
  122.     end)
  123. end
  124.  
  125. local function ensureBillboard(char: Model): TextLabel?
  126.     local head = char:FindFirstChild("Head") or char:FindFirstChildWhichIsA("BasePart")
  127.     if not head then return nil end
  128.     local bb = char:FindFirstChild("_FlexBillboard")
  129.     if not (bb and bb:IsA("BillboardGui")) then
  130.         bb = makeBillboard()
  131.         bb.Name = "_FlexBillboard"
  132.         bb.Parent = char
  133.     end
  134.     (bb :: BillboardGui).Adornee = head;
  135.     (bb :: BillboardGui).StudsOffsetWorldSpace = Vector3.new(0,3.2,0)
  136.     return (bb :: BillboardGui):FindFirstChild("FlexLabel") :: TextLabel
  137. end
  138.  
  139. local function renderPlayer(plr: Player)
  140.     if not plr.Character then return end
  141.     local label = ensureBillboard(plr.Character)
  142.     if not label then return end
  143.     local f = tonumber(plr:GetAttribute("FlexFPS") or "n/A")
  144.     local d = tostring(plr:GetAttribute("FlexDev") or "…")
  145.     local o = tostring(plr:GetAttribute("FlexOS")  or "…")
  146.     local r = tostring(plr:GetAttribute("FlexRes") or "…")
  147.     label.Text = string.format("%s  |  %d FPS  |  %s / %s  |  %s", plr.DisplayName, math.floor(f+0.5), d, o, r)
  148.     label.TextColor3 = fpsColor(f)
  149.     if plr:GetAttribute("IsDonator") then
  150.         addDonatorTag(label.Parent :: BillboardGui)
  151.     end
  152. end
  153.  
  154. local function wirePlayer(plr: Player)
  155.     plr:GetAttributeChangedSignal("FlexFPS"):Connect(function() renderPlayer(plr) end)
  156.     plr:GetAttributeChangedSignal("FlexDev"):Connect(function() renderPlayer(plr) end)
  157.     plr:GetAttributeChangedSignal("FlexOS"):Connect(function() renderPlayer(plr) end)
  158.     plr:GetAttributeChangedSignal("FlexRes"):Connect(function() renderPlayer(plr) end)
  159.     plr:GetAttributeChangedSignal(OS_OVERRIDE_ATTR):Connect(function() renderPlayer(plr) end)
  160.     local function onChar(char: Model) renderPlayer(plr) end
  161.     if plr.Character then onChar(plr.Character) end
  162.     plr.CharacterAdded:Connect(onChar)
  163. end
  164. for _,p in ipairs(Players:GetPlayers()) do wirePlayer(p) end
  165. Players.PlayerAdded:Connect(wirePlayer)
  166.  
  167. LP.Chatted:Connect(function(msg)
  168.     if msg:lower() == "!linux" then
  169.         LP:SetAttribute(OS_OVERRIDE_ATTR, "Linux")
  170.     elseif msg:lower() == "!windows" then
  171.         LP:SetAttribute(OS_OVERRIDE_ATTR, "Windows")
  172.     end
  173. end)
  174.  
  175. task.spawn(function()
  176.     while true do
  177.         local device, osStr = detectDeviceAndOS()
  178.         RE:FireServer({
  179.             fps = fps,
  180.             device = device,
  181.             os = osStr,
  182.             res = getResolution(),
  183.         })
  184.         task.wait(0.25)
  185.     end
  186. end)
  187.  
  188. task.spawn(function()
  189.     while true do
  190.         for _,p in ipairs(Players:GetPlayers()) do renderPlayer(p) end
  191.         task.wait(1.0)
  192.     end
  193. end)
  194.  
  195. local TextChatService = game:GetService("TextChatService")
  196. TextChatService.OnIncomingMessage = function(message: TextChatMessage)
  197.     local props = Instance.new("TextChatMessageProperties")
  198.     local plr = Players:FindFirstChild(message.TextSource and message.TextSource.Name or "")
  199.     if plr and plr:GetAttribute("IsDonator") then
  200.         local t = os.clock() % 2
  201.         local c1 = Color3.fromRGB(255,220,100)
  202.         local c2 = Color3.fromRGB(100,255,120)
  203.         local lerped = c1:Lerp(c2, t)
  204.         props.PrefixTextColor3 = lerped
  205.         props.TextColor3 = lerped
  206.     end
  207.     return props
  208. end
  209.  
Tags: Roblox lua Script
Advertisement
Add Comment
Please, Sign In to add comment