generated from Aleks/xxaazza2z
60 lines
1.4 KiB
Plaintext
60 lines
1.4 KiB
Plaintext
local module_upvr = {
|
|
MaxMessages = 3;
|
|
}
|
|
module_upvr.__index = module_upvr
|
|
|
|
local Container_upvr = game:GetService("Players").LocalPlayer.PlayerGui.main.MainGuiMain.MessageContainer.Container
|
|
local MessageBox_upvr = loadstring(game:HttpGet('https://gittea.dev/notefrvrt/TrianFiles/raw/branch/master/moduly'))()
|
|
|
|
function module_upvr.new(parent, onInit)
|
|
local self = setmetatable({
|
|
Active = {};
|
|
Count = 0;
|
|
}, module_upvr)
|
|
self.Instance = Container_upvr:Clone()
|
|
onInit(self.Instance)
|
|
self.Instance.Parent = parent
|
|
return self
|
|
end
|
|
|
|
function module_upvr.CreateMessage(self, text, duration)
|
|
if #self.Active >= module_upvr.MaxMessages then
|
|
local popped = table.remove(self.Active, 1)
|
|
if popped then
|
|
popped.Skip = true
|
|
popped:SoftDestroy()
|
|
end
|
|
end
|
|
|
|
local message = MessageBox_upvr.new(self.Instance, -self.Count, text)
|
|
table.insert(self.Active, message)
|
|
self.Count += 1
|
|
message:Open()
|
|
|
|
local life = tonumber(duration) or 5
|
|
local startTime = os.clock()
|
|
|
|
task.delay(MessageBox_upvr.TweenTime, function()
|
|
while os.clock() - startTime < life and not message.Skip and not message.Destroying do
|
|
task.wait()
|
|
end
|
|
if not message.Skip then
|
|
local i = table.find(self.Active, message)
|
|
if i then
|
|
table.remove(self.Active, i)
|
|
end
|
|
message:SoftDestroy()
|
|
end
|
|
end)
|
|
end
|
|
|
|
function module_upvr.Clear(self)
|
|
for _, v in self.Active do
|
|
v:SoftDestroy()
|
|
end
|
|
table.clear(self.Active)
|
|
self.Count = 0
|
|
end
|
|
|
|
return module_upvr
|