From 28f909cf909f220c33666e40c558dafd653ef2a5 Mon Sep 17 00:00:00 2001 From: sindri <33976067+isarsindri@users.noreply.github.com> Date: Mon, 2 Mar 2026 14:09:24 +0100 Subject: [PATCH] Add nil check for UserInputService Added a nil check for UserInputService to handle non-Roblox environments. --- src/slider.luau | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/slider.luau b/src/slider.luau index 5ab6b33..e285dd9 100644 --- a/src/slider.luau +++ b/src/slider.luau @@ -1,4 +1,4 @@ -local UserInputService = game:GetService("UserInputService") +local UserInputService = game and game:GetService("UserInputService") or nil local function clamp(x, a, b) if x < a then return a end @@ -140,6 +140,12 @@ return function(create, source, action, cleanup) create "UIStroke" { Thickness = 1, Color = Color3.fromRGB(0, 0, 0), Transparency = 0.75 }, action(function(btn) + -- In non-Roblox test environments, game/UserInputService may not exist. + -- The slider should still be requireable, and still render; dragging is disabled. + if not UserInputService then + return + end + local dragInput local dragging = false local beganConn