/
GameVersionUtils.lua
54 lines (47 loc) · 1.06 KB
/
GameVersionUtils.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--[=[
Utility functions to automatically detect the version a game is running at
@class GameVersionUtils
]=]
local RunService = game:GetService("RunService")
local GameVersionUtils = {}
--[=[
Gets the game build
@return string
]=]
function GameVersionUtils.getBuild()
if RunService:IsStudio() then
return "studio"
else
return ("%d"):format(game.PlaceVersion)
end
end
--[=[
Gets the game build with a server type specified for debugging
@return string
]=]
function GameVersionUtils.getBuildWithServerType()
return GameVersionUtils.getBuild() .. "-" .. GameVersionUtils.getServerType()
end
--[=[
Gets a string label for the current server type
@return string
]=]
function GameVersionUtils.getServerType()
if game.PrivateServerId ~= "" then
if game.PrivateServerOwnerId ~= 0 then
return "vip"
else
return "reserved"
end
else
return "standard"
end
end
--[=[
Returns true if we're a VIP server
@return boolean
]=]
function GameVersionUtils.isVIPServer()
return game.PrivateServerId ~= "" and game.PrivateServerOwnerId ~= 0
end
return GameVersionUtils