-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClient.luau
More file actions
23 lines (17 loc) · 796 Bytes
/
Client.luau
File metadata and controls
23 lines (17 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Networker = require(ReplicatedStorage.Packages.Networker)
local CodeServiceUtils = require(script.Parent.CodeServiceUtils)
local CodeServiceClient = {}
function CodeServiceClient.init(self: CodeServiceClient): ()
self.networker = Networker.client.new("CodeService", self)
end
function CodeServiceClient.redeem(self: CodeServiceClient, code: string): (boolean, string)
local response = self.networker:fetch("redeem", code)
local success = response == CodeServiceUtils.REDEEM_ENUMS.success
local str = CodeServiceUtils.ERROR_CODES[response] or "Unknown Error!"
return success, str
end
type CodeServiceClient = typeof(CodeServiceClient) & {
networker: Networker.Client,
}
return CodeServiceClient :: CodeServiceClient