Phenite

script

Jan 16th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.61 KB | None | 0 0
  1. function new(t,pr)
  2.     local p = Instance.new(t)
  3.     if pr then
  4.         for i,v in next,pr do
  5.             if i ~= "Parent" then
  6.                 p[i] = v
  7.             end
  8.         end
  9.         p.Parent = pr.Parent
  10.     end
  11.     return p
  12. end
  13.  
  14. local Msg = new("Frame",{Name = "Message",Size = UDim2.new(1,0,.3,0),AnchorPoint = Vector2.new(.5,1),Position = UDim2.new(.5,0,1,0),BackgroundTransparency = 1})
  15. new("Frame",{Parent = Msg,Name = "Center",Size = UDim2.new(.45,0,.7,0),AnchorPoint = Vector2.new(.5,1),Position = UDim2.new(.5,0,.7,0),BackgroundTransparency = 1})
  16. new("ImageLabel",{Parent = Msg,Name = "FGColor",Size = UDim2.new(.3,0,.3,0),SizeConstraint = "RelativeYY",AnchorPoint = Vector2.new(.5,1),Position = UDim2.new(.5,0,1,0),BackgroundTransparency = 1,Image = "rbxassetid://382263099",Rotation = 180})
  17. new("Frame",{Parent = Msg.Center,Name = "BGColor",BorderSizePixel = 0,Size = UDim2.new(1.1,0,1,0),AnchorPoint = Vector2.new(.5,.5),Position = UDim2.new(.5,0,.5,0),BackgroundColor3 = Color3.new(1,1,1)})
  18. new("Frame",{Parent = Msg.Center,Name = "BGColor",BorderSizePixel = 0,Size = UDim2.new(1.187,0,.5,0),AnchorPoint = Vector2.new(.5,.5),Position = UDim2.new(.5,0,.5,0),BackgroundColor3 = Color3.new(1,1,1)})
  19. new("Frame",{Parent = Msg.Center,Name = "FGColor",BorderSizePixel = 0,ZIndex = 2,Size = UDim2.new(1.1,0,.125,0),AnchorPoint = Vector2.new(.5,0),Position = UDim2.new(.5,0,0,0),BackgroundColor3 = Color3.new(1,1,1)})
  20. new("Frame",{Parent = Msg.Center,Name = "FGColor",BorderSizePixel = 0,ZIndex = 2,Size = UDim2.new(1.1,0,.125,0),AnchorPoint = Vector2.new(.5,1),Position = UDim2.new(.5,0,1,0),BackgroundColor3 = Color3.new(1,1,1)})
  21. new("ImageLabel",{Parent = Msg.Center,Name = "BGColor",Size = UDim2.new(.5,0,.5,0),SizeConstraint = "RelativeYY",AnchorPoint = Vector2.new(1,0),Position = UDim2.new(),BackgroundTransparency = 1,Image = "rbxassetid://377517897"})
  22. new("ImageLabel",{Parent = Msg.Center,Name = "BGColor",Size = UDim2.new(.5,0,.5,0),SizeConstraint = "RelativeYY",AnchorPoint = Vector2.new(1,1),Position = UDim2.new(0,0,1,0),BackgroundTransparency = 1,Image = "rbxassetid://377517897"})
  23. new("ImageLabel",{Parent = Msg.Center,Name = "BGColor",Size = UDim2.new(.5,0,.5,0),SizeConstraint = "RelativeYY",AnchorPoint = Vector2.new(0,0),Position = UDim2.new(1,0,0,0),BackgroundTransparency = 1,Image = "rbxassetid://377517897"})
  24. new("ImageLabel",{Parent = Msg.Center,Name = "BGColor",Size = UDim2.new(.5,0,.5,0),SizeConstraint = "RelativeYY",AnchorPoint = Vector2.new(0,1),Position = UDim2.new(1,0,1,0),BackgroundTransparency = 1,Image = "rbxassetid://377517897"})
  25. new("ImageLabel",{Parent = Msg.Center,Name = "FGColor",ZIndex = 2,Size = UDim2.new(.5,0,.125,0),SizeConstraint = "RelativeYY",AnchorPoint = Vector2.new(1,0),Position = UDim2.new(),BackgroundTransparency = 1,Image = "rbxassetid://377517897",ImageRectSize = Vector2.new(1000,250)})
  26. new("ImageLabel",{Parent = Msg.Center,Name = "FGColor",ZIndex = 2,Size = UDim2.new(.5,0,.125,0),SizeConstraint = "RelativeYY",AnchorPoint = Vector2.new(1,1),Position = UDim2.new(0,0,1,0),BackgroundTransparency = 1,Image = "rbxassetid://377517897",ImageRectSize = Vector2.new(1000,250),ImageRectOffset = Vector2.new(0,750)})
  27. new("ImageLabel",{Parent = Msg.Center,Name = "FGColor",ZIndex = 2,Size = UDim2.new(.5,0,.125,0),SizeConstraint = "RelativeYY",AnchorPoint = Vector2.new(0,0),Position = UDim2.new(1,0,0,0),BackgroundTransparency = 1,Image = "rbxassetid://377517897",ImageRectSize = Vector2.new(1000,250)})
  28. new("ImageLabel",{Parent = Msg.Center,Name = "FGColor",ZIndex = 2,Size = UDim2.new(.5,0,.125,0),SizeConstraint = "RelativeYY",AnchorPoint = Vector2.new(0,1),Position = UDim2.new(1,0,1,0),BackgroundTransparency = 1,Image = "rbxassetid://377517897",ImageRectSize = Vector2.new(1000,250),ImageRectOffset = Vector2.new(0,750)})
  29. new("TextLabel",{Parent = Msg.Center,BackgroundTransparency = 1,ZIndex = 3,Size = UDim2.new(1.1,0,.625,0),AnchorPoint = Vector2.new(.5,.5),Position = UDim2.new(.5,0,.5,0),BackgroundTransparency = 1,TextXAlignment = "Left",TextScaled = true,Font = "SourceSans"})
  30.  
  31. function Color(it,co)
  32.     if it:IsA("ImageLabel") then
  33.         it.ImageColor3 = co
  34.     elseif it:IsA("TextLabel") then
  35.         it.TextColor3 = co
  36.     elseif it:IsA("Frame") then
  37.         it.BackgroundColor3 = co
  38.     end
  39. end
  40. local PosEffects = {
  41.     Wave = function(i,msg,postt)
  42.         local t = tick() - postt
  43.         local tp = math.fmod(t,2) * math.pi
  44.         msg.Center.AnchorPoint = Vector2.new(math.sin(tp)/2 + .5,1)
  45.     end,
  46.     Edgy = function(i,msg,postt)
  47.         local m1 = math.random() * 2 - 1
  48.         local m2 = math.random() * 2 - 1
  49.         msg.Center.AnchorPoint = Vector2.new(.5 + m1 * m2/10,1)
  50.     end,
  51.     Explode = function(i,msg,postt)
  52.         local t = tick() - postt
  53.         local m = (1/(t + .1))
  54.         local m2  = math.asin(math.max(0,1 - t/5))/math.pi
  55.         msg.Center.AnchorPoint = Vector2.new(math.sin(m * 2 * math.pi)/2 * m2 + .5,1)
  56.     end
  57. }
  58. local ColEffects = {
  59.     Flash = function(i,msg,postt,t)
  60.         local lerpm = math.clamp((tick() - postt) * 2 - 1,0,1)
  61.         local bg = Color3.new(1,1,1):lerp(t.BGColor,lerpm)
  62.         local fg = Color3.new(1,1,1):lerp(t.FGColor,lerpm)
  63.         local tc = Color3.new(1,1,1):lerp(t.TC,lerpm)
  64.         Color(msg.FGColor,fg)
  65.         for i,v in next,msg.Center:GetChildren() do
  66.             if v.Name == "FGColor" then
  67.                 Color(v,fg)
  68.             elseif v.Name == "BGColor" then
  69.                 Color(v,bg)
  70.             elseif v:IsA("TextLabel") then
  71.                 Color(v,tc)
  72.             end
  73.         end
  74.     end,
  75.     None = function(_,msg,_,t)
  76.         Color(msg.FGColor,t.FGColor)
  77.         for i,v in next,msg.Center:GetChildren() do
  78.             if v.Name == "FGColor" then
  79.                 Color(v,t.FGColor)
  80.             elseif v.Name == "BGColor" then
  81.                 Color(v,t.BGColor)
  82.             elseif v:IsA("TextLabel") then
  83.                 Color(v,t.TC)
  84.             end
  85.         end
  86.     end
  87. }
  88.  
  89. local Msgs = {}
  90.  
  91. repeat wait() until game.Players.LocalPlayer.Character
  92. Head = game.Players.LocalPlayer.Character:WaitForChild("Head")
  93. Gui = new("BillboardGui",{Parent = Head,Name = "Chat",Size = UDim2.new(10,0,4,0),SizeOffset = Vector2.new(0,.5),StudsOffsetWorldSpace = Vector3.new(0,1,0)})
  94.  
  95. local DFBGC = Color3.new(1,1,1)
  96. local DFFGC = Color3.fromRGB(200,150,255)
  97. local DFTC = Color3.new()
  98. local DFPE = nil
  99. local DFCE = "None"
  100.  
  101. function HTC(t)
  102.     if #t ~= 6 then
  103.         return Color3.new()
  104.     else
  105.         local r,g,b = t:sub(1,2),t:sub(3,4),t:sub(5,6)
  106.         r,g,b = tonumber(r,16),tonumber(g,16),tonumber(b,16)
  107.         if r and g and b then
  108.             return Color3.fromRGB(r,g,b)
  109.         else
  110.             return Color3.new()
  111.         end
  112.     end
  113. end
  114. function TTP(t)
  115.     if PosEffects[t] then
  116.         return t
  117.     else
  118.         return nil
  119.     end
  120. end
  121. function TTC(t)
  122.     if ColEffects[t] and t ~= "None" then
  123.         return t
  124.     else
  125.         return nil
  126.     end
  127. end
  128.  
  129. function newMsg(c)
  130.     if c:sub(1,1) ~= "/" then
  131.         local msg = Msg:Clone()
  132.         for i,v in next,Gui:GetChildren() do
  133.             v.Position = v.Position - UDim2.new(0,0,1/3,0)
  134.         end
  135.         msg.Parent = Gui
  136.         local msgt = {
  137.             FGColor = DFFGC,
  138.             BGColor = DFBGC,
  139.             TC = DFTC,
  140.             PE = DFPE,
  141.             CE = DFCE,
  142.             PT = tick(),
  143.             Msg = msg
  144.         }
  145.         msg.Center.TextLabel.Text = c
  146.         table.insert(Msgs,1,msgt)
  147.         if Msgs[4] then
  148.             Msgs[4].Msg:Destroy()
  149.             table.remove(Msgs,4)
  150.         end
  151.     else
  152.         if c:sub(1,7) == "/setFG " then
  153.             DFFGC = HTC(c:sub(8))
  154.         elseif c:sub(1,7) == "/setBG " then
  155.             DFBGC = HTC(c:sub(8))
  156.         elseif c:sub(1,7) == "/setTC " then
  157.             DFTC = HTC(c:sub(8))
  158.         elseif c:sub(1,7) == "/setPE " then
  159.             DFPE = TTP(c:sub(8))
  160.         elseif c:sub(1,7) == "/setCE " then
  161.             DFCE = TTC(c:sub(8))
  162.         end
  163.     end
  164. end
  165.  
  166. game.Players.LocalPlayer.Chatted:connect(newMsg)
  167.  
  168. game:GetService("RunService").RenderStepped:connect(function(dt)
  169.     for i,v in next,Msgs do
  170.         if tick() - v.PT > 10 then
  171.             v.Msg:Destroy()
  172.             table.remove(Msgs,i)
  173.         else
  174.             if v.PE then
  175.                 PosEffects[v.PE](i,v.Msg,v.PT,v)
  176.             end
  177.             if v.CE then
  178.                 ColEffects[v.CE](i,v.Msg,v.PT,v)
  179.             else
  180.                 ColEffects["None"](i,v.Msg,v.PT,v)
  181.             end
  182.         end
  183.     end
  184. end)
Advertisement
Add Comment
Please, Sign In to add comment