сделай что бы максимальное количество Popup было 5 штук local TweenService =…
- User
сделай что бы максимальное количество Popup было 5 штук local TweenService = game:GetService("TweenService") local RP = game:GetService("ReplicatedStorage")
local Player = game.Players.LocalPlayer
local popupRemote = RP.Remotes.DisplayPopup local popupBindable = RP.Remotes.DisplayPopupBindable
local popupFrame = Player.PlayerGui:WaitForChild("Popup"):WaitForChild("Frame")
local Template = popupFrame:WaitForChild("Template") Template.Size = UDim2.new(0,0,0,0) -- reset the size just for tweening Template.Parent = popupFrame.Parent
local popupTime = 2.5
local sizeTween ={ info = TweenInfo.new(.5, Enum.EasingStyle.Back, Enum.EasingDirection.Out), props = { Size = UDim2.new(0, 260, 0, 39) } } local opacityInfo = { info = TweenInfo.new(0.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut), props = { TextTransparency = 1 } }
local Shared = {} local Local = {}
popupRemote.OnClientEvent:Connect(function(text) ShowPopup(text) end)
popupBindable.Event:Connect(function(text) ShowPopup(text) end)
function ShowPopup(displayText : string) local newPopup = Template:Clone() newPopup.Text = displayText newPopup.Parent = popupFrame
task.spawn(function() TweenService:Create(newPopup, sizeTween.info, sizeTween.props):Play() --size tween task.wait(popupTime) local opacityTween = TweenService:Create(newPopup, opacityInfo.info, opacityInfo.props) opacityTween:Play() opacityTween.Completed:Connect(function() newPopup:Destroy() end) end)end
return Shared
- Assistant