Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ChatTable = {
- --- {'SpeakerName','Chat Message'};
- {'Person1','Just testing this UI currently.'};
- {'Person2','Oh, cool.'};
- {'Person1','I just decided to mess around with UI stuff, and I am too lazy to bother using Renpy.'};
- {'Person1','I will eventually get to using it.'};
- {'Person2','Oh, okay.'};
- {'Person1','See ya later.'};
- }
- local ChatData = {
- --- ['SpeakerName'] = {BackgroundColor,BorderColor,ChatColor,Font}
- ['Person1'] = {Color3.fromRGB(56, 56, 56),Color3.fromRGB(0,0,0),Color3.fromRGB(255, 255, 255),Enum.Font.Code};
- ['Person2'] = {Color3.fromRGB(255, 170, 255),Color3.fromRGB(255, 85, 255),Color3.fromRGB(200, 20, 200),Enum.Font.Cartoon};
- }
- -----------------------------------------------------
- local uiService = game:GetService('UserInputService')
- local MainFrame = script.Parent:WaitForChild('MainFrame')
- local TextBar = MainFrame:WaitForChild('ChatTextGui')
- local Speaker = MainFrame:WaitForChild('SpeakerName')
- local CurrentChat = 1
- local IsChatFinished = false
- local function ChatFunction()
- local Chat = ChatTable[CurrentChat]
- if IsChatFinished then
- IsChatFinished = false
- CurrentChat = CurrentChat + 1
- if CurrentChat > #ChatTable then return end
- ChatFunction()
- elseif not IsChatFinished then
- Speaker.Text = Chat[1]
- MainFrame.BackgroundColor3 = ChatData[Chat[1]][1]
- MainFrame.BorderColor3 = ChatData[Chat[1]][2]
- TextBar.Text = ''
- TextBar.TextColor3 = ChatData[Chat[1]][3]
- TextBar.Font = ChatData[Chat[1]][4]
- for i = string.len(Chat[2]),0,-1 do
- if IsChatFinished then
- TextBar.Text = Chat[2]
- IsChatFinished = true
- break
- end
- TextBar.Text = string.sub(Chat[2],1,string.len(Chat[2])-i)
- wait(.05)
- end
- IsChatFinished = true
- end
- end
- wait(2)
- spawn(uiService.InputBegan:Connect(function(Input)
- if Input.UserInputType == Enum.UserInputType.MouseButton1 then
- if not IsChatFinished then
- IsChatFinished = true
- return
- end
- ChatFunction()
- elseif Input.UserInputType == Enum.UserInputType.Touch then
- if not IsChatFinished then
- IsChatFinished = true
- return
- end
- ChatFunction()
- end
- end))
- ChatFunction()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement