Last active
August 10, 2024 22:39
-
-
Save MaximumADHD/1a7e045afc7beb6f472f8e5f684e2aa0 to your computer and use it in GitHub Desktop.
RunContext - What's the running context of your code?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--!strict | |
local UserInputService = game:GetService("UserInputService") | |
local GuiService = game:GetService("GuiService") | |
local RunService = game:GetService("RunService") | |
local VRService = game:GetService("VRService") | |
local isEdit = false | |
local isServer = RunService:IsServer() | |
local isClient = RunService:IsClient() | |
local isStudio = RunService:IsStudio() | |
local isOnline = game.JobId ~= "" | |
local isRCC = isOnline and isServer | |
pcall(function () | |
isEdit = RunService:IsEdit() | |
end) | |
return table.freeze({ | |
IsRCC = isRCC, | |
IsEdit = isEdit, | |
IsTestRun = isStudio | |
and not isEdit, | |
IsServer = isServer, | |
IsClient = isClient, | |
IsStudio = isStudio, | |
IsOnline = isOnline, | |
IsTenFoot = GuiService:IsTenFootInterface(), | |
IsTouch = UserInputService.TouchEnabled, | |
IsVR = VRService.VREnabled, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I Agree (I Have No Idea What Any Of This Means)