local cloneref = cloneref or function(obj) return obj end local replicatedStorage = cloneref(game:GetService('ReplicatedStorage')) local MatchUI = replicatedStorage.Remotes.MatchUI local SubmitWord = replicatedStorage.Remotes.SubmitWord local BillboardUpdate = replicatedStorage.Remotes.BillboardUpdate local Used, Prefix, CurrentLetter = {}, {}, nil local Answered, Ready = false, false local Round = 1 task.spawn(function() if not shared.kbbiwords then local Ok, Res = pcall(game.HttpGet, game, 'https://raw.githubusercontent.com/getnilinstances/EpavV4/refs/heads/main/miscellaneous/wordlist.txt', true) -- the core if not Ok or not Res then return end shared.kbbiwords = Res end for Word in string.gmatch(shared.kbbiwords, '[^\r\n]+') do local W = string.lower(Word) if string.match(W, '^[a-z]+$') and #W >= 3 and #W <= 15 then for Len = 1, math.min(3, #W) do local P = string.sub(W, 1, Len) Prefix[P] = Prefix[P] or {} table.insert(Prefix[P], W) end end end Ready = true end) local function FindWord(Letter) local Pool = Prefix[Letter] if not Pool then return end local T = {} for _, W in ipairs(Pool) do if not Used[W] then T[#T+1] = W end end return #T > 0 and T[math.random(#T)] or nil end local function Update(Word, Already) for I = #Already + 1, #Word do BillboardUpdate:FireServer(string.sub(Word, 1, I)) task.wait(math.random(8, 18) / 100) end end local function DoAnswer() if not CurrentLetter then return end local Words = FindWord(CurrentLetter) if not Words then return end Used[W] = true task.wait(math.random(30, 80) / 100) Update(Words, CurrentLetter) task.wait(math.random(5, 15) / 100) SubmitWord:FireServer(Words) end local function Answer() if not CurrentLetter or Answered then return end Answered = true task.spawn(function() local T = 0 while not Ready and T < 15 do task.wait(0.5) T += 0.5 end if Ready then DoAnswer() end end) end MatchUI.OnClientEvent:Connect(function(Event, Data) if Event == 'UpdateServerLetter' and type(Data) == 'string' then CurrentLetter = string.lower(Data) Answered = false elseif Event == 'StartTurn' then Round += 1 Answered = false Answer() elseif Event == 'Mistake' then Answered = false task.wait(0.3) Answer() elseif Event == 'EndTurn' then CurrentLetter = nil Answered = false end end)