Add nil check for UserInputService

Added a nil check for UserInputService to handle non-Roblox environments.
This commit is contained in:
sindri 2026-03-02 14:09:24 +01:00 committed by GitHub
parent bf4f46f784
commit 28f909cf90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,4 @@
local UserInputService = game:GetService("UserInputService") local UserInputService = game and game:GetService("UserInputService") or nil
local function clamp(x, a, b) local function clamp(x, a, b)
if x < a then return a end 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 }, create "UIStroke" { Thickness = 1, Color = Color3.fromRGB(0, 0, 0), Transparency = 0.75 },
action(function(btn) 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 dragInput
local dragging = false local dragging = false
local beganConn local beganConn