chat sender ye UPD
Key RequiredUniversal

chat sender ye UPD

Universal ScriptTheRealCheeseTheRealCheese 634 views 1.6K executesUpdated Sep 9, 2026
Unrated
00
Lua Script•1178 lines (31258 chars)
local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local UserInputService = game:GetService("UserInputService")
local HttpService = game:GetService("HttpService")

local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

--//==================================================
--// SETTINGS
--//==================================================

local messages = {}

local autoRandomEnabled = false
local AUTO_RANDOM_DELAY = 5
local lastRandomIndex = nil

local uiScale = 1
local transparency = 0

local accentColor = Color3.fromRGB(55, 55, 62)

-- Floating quick sentences
local quickSentencesEnabled = true
local quickConfig = {}
-- quickConfig["message"] = {
--     x = number,
--     y = number,
--     locked = boolean
-- }

local quickFrames = {}
local quickDragConnections = {}

local SAVE_FILE = "ChatSenderYe_Messages.json"
local SETTINGS_FILE = "ChatSenderYe_Settings.json"

--//==================================================
--// REMOVE OLD GUI IF SCRIPT IS RAN AGAIN
--//==================================================

local oldGui = playerGui:FindFirstChild("ChatSenderYe_UPD")

if oldGui then
	oldGui:Destroy()
end

--//==================================================
--// FILE FUNCTIONS
--//==================================================

local function loadMessages()
	if isfile and readfile and isfile(SAVE_FILE) then
		local success, data = pcall(function()
			return HttpService:JSONDecode(readfile(SAVE_FILE))
		end)

		if success and type(data) == "table" then
			messages = {}

			for _, message in ipairs(data) do
				if type(message) == "string" and message ~= "" then
					table.insert(messages, message)
				end
			end
		end
	end
end

local function saveMessages()
	if writefile then
		pcall(function()
			writefile(SAVE_FILE, HttpService:JSONEncode(messages))
		end)
	end
end

local function loadSettings()
	if isfile and readfile and isfile(SETTINGS_FILE) then
		local success, data = pcall(function()
			return HttpService:JSONDecode(readfile(SETTINGS_FILE))
		end)

		if success and type(data) == "table" then

			if tonumber(data.uiScale) then
				uiScale = math.clamp(tonumber(data.uiScale), 0.7, 1.4)
			end

			if tonumber(data.transparency) then
				transparency = math.clamp(tonumber(data.transparency), 0, 0.7)
			end

			if type(data.quickSentencesEnabled) == "boolean" then
				quickSentencesEnabled = data.quickSentencesEnabled
			end

			if type(data.quickConfig) == "table" then
				quickConfig = {}

				for message, config in pairs(data.quickConfig) do
					if type(message) == "string" and type(config) == "table" then

						quickConfig[message] = {
							x = tonumber(config.x) or 10,
							y = tonumber(config.y) or 150,
							locked = config.locked == true
						}

					end
				end
			end
		end
	end
end

local function saveSettings()
	if writefile then
		pcall(function()
			writefile(
				SETTINGS_FILE,
				HttpService:JSONEncode({
					uiScale = uiScale,
					transparency = transparency,
					quickSentencesEnabled = quickSentencesEnabled,
					quickConfig = quickConfig
				})
			)
		end)
	end
end

loadMessages()
loadSettings()

--//==================================================
--// HELPERS
--//==================================================

local function messageExists(message)
	for _, savedMessage in ipairs(messages) do
		if savedMessage == message then
			return true
		end
	end

	return false
end

local function getDefaultQuickPosition(index)
	local camera = workspace.CurrentCamera

	local x = 10
	local y = 120 + ((index - 1) * 50)

	if camera then
		local viewport = camera.ViewportSize

		if y > viewport.Y - 55 then
			y = 100
		end
	end

	return x, y
end

local function clampQuickPosition(frame, x, y)
	local camera = workspace.CurrentCamera

	if not camera then
		return x, y
	end

	local viewport = camera.ViewportSize

	local maxX = math.max(0, viewport.X - frame.AbsoluteSize.X)
	local maxY = math.max(0, viewport.Y - frame.AbsoluteSize.Y)

	return math.clamp(x, 0, maxX),
		math.clamp(y, 0, maxY)
end

--//==================================================
--// SEND MESSAGE
--//==================================================

local function sendMessage(message)
	if not message or message == "" then
		return
	end

	pcall(function()
		local channels = TextChatService:FindFirstChild("TextChannels")

		if channels then
			local general = channels:FindFirstChild("RBXGeneral")

			if general then
				general:SendAsync(message)
			end
		end
	end)
end

--//==================================================
--// GUI
--//==================================================

local gui = Instance.new("ScreenGui")
gui.Name = "ChatSenderYe_UPD"
gui.ResetOnSpawn = false
gui.IgnoreGuiInset = false
gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
gui.DisplayOrder = 20
gui.Parent = playerGui

--//==================================================
--// MAIN WINDOW
--//==================================================

local main = Instance.new("Frame")
main.Name = "Main"
main.Size = UDim2.fromOffset(280, 350)
main.Position = UDim2.new(0.5, -140, 0.5, -175)
main.BackgroundColor3 = Color3.fromRGB(25, 25, 29)
main.BackgroundTransparency = transparency
main.BorderSizePixel = 0
main.ZIndex = 10
main.Parent = gui

Instance.new("UICorner", main).CornerRadius = UDim.new(0, 18)

--//==================================================
--// HEADER
--//==================================================

local header = Instance.new("Frame")
header.Size = UDim2.new(1, 0, 0, 62)
header.BackgroundTransparency = 1
header.ZIndex = 11
header.Parent = main

local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, -105, 1, 0)
title.Position = UDim2.fromOffset(18, 0)
title.BackgroundTransparency = 1
title.Text = "*chat sender ye [UPD]"
title.TextColor3 = Color3.fromRGB(235, 235, 240)
title.TextSize = 20
title.Font = Enum.Font.Gotham
title.TextXAlignment = Enum.TextXAlignment.Left
title.ZIndex = 12
title.Parent = header

local settingsButton = Instance.new("TextButton")
settingsButton.Size = UDim2.fromOffset(45, 45)
settingsButton.Position = UDim2.new(1, -98, 0, 8)
settingsButton.BackgroundTransparency = 1
settingsButton.Text = "⚙"
settingsButton.TextColor3 = Color3.fromRGB(150, 160, 170)
settingsButton.TextSize = 28
settingsButton.Font = Enum.Font.GothamBold
settingsButton.ZIndex = 12
settingsButton.Parent = header

local minimizeButton = Instance.new("TextButton")
minimizeButton.Size = UDim2.fromOffset(40, 40)
minimizeButton.Position = UDim2.new(1, -48, 0, 10)
minimizeButton.BackgroundTransparency = 1
minimizeButton.Text = "×"
minimizeButton.TextColor3 = Color3.fromRGB(190, 190, 195)
minimizeButton.TextSize = 25
minimizeButton.Font = Enum.Font.Gotham
minimizeButton.ZIndex = 12
minimizeButton.Parent = header

--//==================================================
--// MESSAGE INPUT
--//==================================================

local inputBox = Instance.new("TextBox")
inputBox.Name = "MessageInput"
inputBox.Size = UDim2.new(1, -30, 0, 58)
inputBox.Position = UDim2.fromOffset(15, 65)
inputBox.BackgroundColor3 = Color3.fromRGB(34, 34, 40)
inputBox.BackgroundTransparency = transparency
inputBox.BorderSizePixel = 0
inputBox.PlaceholderText = "TextBox"
inputBox.PlaceholderColor3 = Color3.fromRGB(175, 175, 180)
inputBox.Text = ""
inputBox.TextColor3 = Color3.fromRGB(240, 240, 240)
inputBox.TextSize = 18
inputBox.Font = Enum.Font.Gotham
inputBox.ClearTextOnFocus = false
inputBox.ZIndex = 11
inputBox.Parent = main

Instance.new("UICorner", inputBox).CornerRadius = UDim.new(0, 14)

--//==================================================
--// QUICK + AUTO BUTTONS
--//==================================================

local quickToggle = Instance.new("TextButton")
quickToggle.Size = UDim2.fromOffset(95, 36)
quickToggle.Position = UDim2.fromOffset(15, 130)
quickToggle.BackgroundColor3 = accentColor
quickToggle.BackgroundTransparency = transparency
quickToggle.BorderSizePixel = 0
quickToggle.TextColor3 = Color3.fromRGB(235, 235, 240)
quickToggle.TextSize = 13
quickToggle.Font = Enum.Font.GothamMedium
quickToggle.ZIndex = 11
quickToggle.Parent = main

Instance.new("UICorner", quickToggle).CornerRadius = UDim.new(0, 12)

local autoButton = Instance.new("TextButton")
autoButton.Size = UDim2.fromOffset(165, 36)
autoButton.Position = UDim2.fromOffset(115, 130)
autoButton.BackgroundColor3 = Color3.fromRGB(34, 34, 40)
autoButton.BackgroundTransparency = transparency
autoButton.BorderSizePixel = 0
autoButton.TextColor3 = Color3.fromRGB(215, 215, 220)
autoButton.TextSize = 13
autoButton.Font = Enum.Font.GothamMedium
autoButton.ZIndex = 11
autoButton.Parent = main

Instance.new("UICorner", autoButton).CornerRadius = UDim.new(0, 12)

--//==================================================
--// SAVED MESSAGE SCROLL
--//==================================================

local messageScroll = Instance.new("ScrollingFrame")
messageScroll.Name = "SavedMessages"
messageScroll.Size = UDim2.new(1, -30, 0, 164)
messageScroll.Position = UDim2.fromOffset(15, 175)
messageScroll.BackgroundTransparency = 1
messageScroll.BorderSizePixel = 0
messageScroll.ScrollBarThickness = 3
messageScroll.ScrollBarImageColor3 = Color3.fromRGB(90, 90, 100)
messageScroll.CanvasSize = UDim2.new(0, 0, 0, 0)
messageScroll.ZIndex = 11
messageScroll.Parent = main

local messageLayout = Instance.new("UIListLayout")
messageLayout.Padding = UDim.new(0, 8)
messageLayout.SortOrder = Enum.SortOrder.LayoutOrder
messageLayout.Parent = messageScroll

messageLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
	messageScroll.CanvasSize = UDim2.fromOffset(
		0,
		messageLayout.AbsoluteContentSize.Y + 5
	)
end)

--//==================================================
--// ADD MESSAGE BUTTON
--//==================================================

local addButton = Instance.new("TextButton")
addButton.Size = UDim2.fromOffset(55, 55)
addButton.Position = UDim2.new(1, -70, 1, -70)
addButton.BackgroundColor3 = accentColor
addButton.BackgroundTransparency = transparency
addButton.BorderSizePixel = 0
addButton.Text = "+"
addButton.TextColor3 = Color3.fromRGB(245, 245, 245)
addButton.TextSize = 28
addButton.Font = Enum.Font.GothamMedium
addButton.ZIndex = 12
addButton.Parent = main

Instance.new("UICorner", addButton).CornerRadius = UDim.new(1, 0)

--//==================================================
--// MINIMIZED CIRCLE
--//==================================================

local miniCircle = Instance.new("TextButton")
miniCircle.Name = "MiniCircle"
miniCircle.Size = UDim2.fromOffset(55, 55)
miniCircle.Position = UDim2.new(0, 20, 0.5, -27)
miniCircle.BackgroundColor3 = Color3.fromRGB(35, 35, 40)
miniCircle.BackgroundTransparency = transparency
miniCircle.BorderSizePixel = 0
miniCircle.Text = "C"
miniCircle.TextColor3 = Color3.fromRGB(235, 235, 240)
miniCircle.TextSize = 20
miniCircle.Font = Enum.Font.GothamBold
miniCircle.Visible = false
miniCircle.ZIndex = 20
miniCircle.Parent = gui

Instance.new("UICorner", miniCircle).CornerRadius = UDim.new(1, 0)

--//==================================================
--// SETTINGS PANEL
--//==================================================

local settingsPanel = Instance.new("Frame")
settingsPanel.Name = "Settings"
settingsPanel.Size = UDim2.fromOffset(280, 220)
settingsPanel.Position = UDim2.new(0.5, -140, 0.5, -110)
settingsPanel.BackgroundColor3 = Color3.fromRGB(25, 25, 29)
settingsPanel.BackgroundTransparency = transparency
settingsPanel.BorderSizePixel = 0
settingsPanel.Visible = false
settingsPanel.ZIndex = 50
settingsPanel.Parent = gui

Instance.new("UICorner", settingsPanel).CornerRadius = UDim.new(0, 18)

local settingsTitle = Instance.new("TextLabel")
settingsTitle.Size = UDim2.new(1, -60, 0, 50)
settingsTitle.Position = UDim2.fromOffset(18, 5)
settingsTitle.BackgroundTransparency = 1
settingsTitle.Text = "options"
settingsTitle.TextColor3 = Color3.fromRGB(235, 235, 240)
settingsTitle.TextSize = 20
settingsTitle.Font = Enum.Font.GothamMedium
settingsTitle.TextXAlignment = Enum.TextXAlignment.Left
settingsTitle.ZIndex = 51
settingsTitle.Parent = settingsPanel

local settingsClose = Instance.new("TextButton")
settingsClose.Size = UDim2.fromOffset(45, 45)
settingsClose.Position = UDim2.new(1, -50, 0, 5)
settingsClose.BackgroundTransparency = 1
settingsClose.Text = "×"
settingsClose.TextColor3 = Color3.fromRGB(190, 190, 195)
settingsClose.TextSize = 25
settingsClose.Font = Enum.Font.Gotham
settingsClose.ZIndex = 52
settingsClose.Parent = settingsPanel

-- Scale

local scaleLabel = Instance.new("TextLabel")
scaleLabel.Size = UDim2.new(1, -30, 0, 35)
scaleLabel.Position = UDim2.fromOffset(15, 60)
scaleLabel.BackgroundTransparency = 1
scaleLabel.TextColor3 = Color3.fromRGB(215, 215, 220)
scaleLabel.TextSize = 14
scaleLabel.Font = Enum.Font.Gotham
scaleLabel.TextXAlignment = Enum.TextXAlignment.Left
scaleLabel.ZIndex = 51
scaleLabel.Parent = settingsPanel

local scaleMinus = Instance.new("TextButton")
scaleMinus.Size = UDim2.fromOffset(45, 35)
scaleMinus.Position = UDim2.fromOffset(15, 95)
scaleMinus.BackgroundColor3 = accentColor
scaleMinus.BorderSizePixel = 0
scaleMinus.Text = "−"
scaleMinus.TextColor3 = Color3.fromRGB(235, 235, 240)
scaleMinus.TextSize = 20
scaleMinus.ZIndex = 51
scaleMinus.Parent = settingsPanel

Instance.new("UICorner", scaleMinus).CornerRadius = UDim.new(0, 9)

local scalePlus = Instance.new("TextButton")
scalePlus.Size = UDim2.fromOffset(45, 35)
scalePlus.Position = UDim2.fromOffset(220, 95)
scalePlus.BackgroundColor3 = accentColor
scalePlus.BorderSizePixel = 0
scalePlus.Text = "+"
scalePlus.TextColor3 = Color3.fromRGB(235, 235, 240)
scalePlus.TextSize = 20
scalePlus.ZIndex = 51
scalePlus.Parent = settingsPanel

Instance.new("UICorner", scalePlus).CornerRadius = UDim.new(0, 9)

-- Transparency

local transparencyLabel = Instance.new("TextLabel")
transparencyLabel.Size = UDim2.new(1, -30, 0, 35)
transparencyLabel.Position = UDim2.fromOffset(15, 140)
transparencyLabel.BackgroundTransparency = 1
transparencyLabel.TextColor3 = Color3.fromRGB(215, 215, 220)
transparencyLabel.TextSize = 14
transparencyLabel.Font = Enum.Font.Gotham
transparencyLabel.TextXAlignment = Enum.TextXAlignment.Left
transparencyLabel.ZIndex = 51
transparencyLabel.Parent = settingsPanel

local transparencyMinus = Instance.new("TextButton")
transparencyMinus.Size = UDim2.fromOffset(45, 35)
transparencyMinus.Position = UDim2.fromOffset(15, 175)
transparencyMinus.BackgroundColor3 = accentColor
transparencyMinus.BorderSizePixel = 0
transparencyMinus.Text = "−"
transparencyMinus.TextColor3 = Color3.fromRGB(235, 235, 240)
transparencyMinus.TextSize = 20
transparencyMinus.ZIndex = 51
transparencyMinus.Parent = settingsPanel

Instance.new("UICorner", transparencyMinus).CornerRadius = UDim.new(0, 9)

local transparencyPlus = Instance.new("TextButton")
transparencyPlus.Size = UDim2.fromOffset(45, 35)
transparencyPlus.Position = UDim2.fromOffset(220, 175)
transparencyPlus.BackgroundColor3 = accentColor
transparencyPlus.BorderSizePixel = 0
transparencyPlus.Text = "+"
transparencyPlus.TextColor3 = Color3.fromRGB(235, 235, 240)
transparencyPlus.TextSize = 20
transparencyPlus.ZIndex = 51
transparencyPlus.Parent = settingsPanel

Instance.new("UICorner", transparencyPlus).CornerRadius = UDim.new(0, 9)

--//==================================================
--// QUICK STATUS
--//==================================================

local function updateQuickToggle()
	if quickSentencesEnabled then
		quickToggle.Text = "QUICK • ON"
		quickToggle.BackgroundColor3 = accentColor
	else
		quickToggle.Text = "QUICK • OFF"
		quickToggle.BackgroundColor3 = Color3.fromRGB(34, 34, 40)
	end
end

local function updateSettingsLabels()
	scaleLabel.Text = "UI SCALE  •  " .. string.format("%.1f", uiScale)
	transparencyLabel.Text = "TRANSPARENCY  •  " ..
		math.floor(transparency * 100) .. "%"
end

--//==================================================
--// MAIN DRAG FUNCTION
--//==================================================

local function makeDraggable(object, dragArea)
	local dragging = false
	local dragStart
	local startPosition

	dragArea.InputBegan:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1
			or input.UserInputType == Enum.UserInputType.Touch then

			dragging = true
			dragStart = input.Position
			startPosition = object.Position
		end
	end)

	UserInputService.InputChanged:Connect(function(input)
		if not dragging then
			return
		end

		if input.UserInputType ~= Enum.UserInputType.MouseMovement
			and input.UserInputType ~= Enum.UserInputType.Touch then
			return
		end

		local delta = input.Position - dragStart

		object.Position = UDim2.new(
			startPosition.X.Scale,
			startPosition.X.Offset + delta.X,
			startPosition.Y.Scale,
			startPosition.Y.Offset + delta.Y
		)
	end)

	UserInputService.InputEnded:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseButton1
			or input.UserInputType == Enum.UserInputType.Touch then

			dragging = false
		end
	end)
end

makeDraggable(main, header)
makeDraggable(settingsPanel, settingsTitle)
makeDraggable(miniCircle, miniCircle)

--//==================================================
--// FORWARD DECLARATIONS
--//==================================================

local refreshMessages
local refreshQuickMinis
local createQuickMini

--//==================================================
--// DESTROY QUICK DRAG CONNECTIONS
--//==================================================

local function clearQuickDragConnections(frame)
	local connections = quickDragConnections[frame]

	if connections then
		for _, connection in ipairs(connections) do
			pcall(function()
				connection:Disconnect()
			end)
		end
	end

	quickDragConnections[frame] = nil
end

--//==================================================
--// CREATE FLOATING QUICK SENTENCE
--//==================================================

createQuickMini = function(message, index)
	if not quickSentencesEnabled then
		return
	end

	if not quickConfig[message] then
		local x, y = getDefaultQuickPosition(index)

		quickConfig[message] = {
			x = x,
			y = y,
			locked = false
		}

		saveSettings()
	end

	local config = quickConfig[message]

	local frame = Instance.new("Frame")
	frame.Name = "Quick_" .. tostring(index)
	frame.Size = UDim2.fromOffset(240, 42)
	frame.Position = UDim2.fromOffset(
		config.x or 10,
		config.y or 120
	)
	frame.BackgroundColor3 = Color3.fromRGB(30, 30, 35)
	frame.BackgroundTransparency = math.clamp(transparency, 0, 0.7)
	frame.BorderSizePixel = 0
	frame.Active = true
	frame.ZIndex = 30
	frame.Parent = gui

	Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 12)

	quickFrames[message] = frame

	-- Sentence button

	local sendButton = Instance.new("TextButton")
	sendButton.Size = UDim2.new(1, -76, 1, 0)
	sendButton.Position = UDim2.fromOffset(0, 0)
	sendButton.BackgroundTransparency = 1
	sendButton.Text = message
	sendButton.TextColor3 = Color3.fromRGB(235, 235, 240)
	sendButton.TextSize = 13
	sendButton.Font = Enum.Font.GothamMedium
	sendButton.TextTruncate = Enum.TextTruncate.AtEnd
	sendButton.TextXAlignment = Enum.TextXAlignment.Left
	sendButton.ZIndex = 31
	sendButton.Parent = frame

	local textPadding = Instance.new("UIPadding")
	textPadding.PaddingLeft = UDim.new(0, 12)
	textPadding.PaddingRight = UDim.new(0, 5)
	textPadding.Parent = sendButton

	-- Lock

	local lockButton = Instance.new("TextButton")
	lockButton.Size = UDim2.fromOffset(35, 34)
	lockButton.Position = UDim2.new(1, -70, 0, 4)
	lockButton.BackgroundColor3 = Color3.fromRGB(48, 48, 55)
	lockButton.BackgroundTransparency = transparency
	lockButton.BorderSizePixel = 0
	lockButton.Text = config.locked and "🔒" or "🔓"
	lockButton.TextColor3 = Color3.fromRGB(230, 230, 235)
	lockButton.TextSize = 14
	lockButton.Font = Enum.Font.Gotham
	lockButton.ZIndex = 32
	lockButton.Parent = frame

	Instance.new("UICorner", lockButton).CornerRadius = UDim.new(0, 9)

	-- Remove floating button

	local removeButton = Instance.new("TextButton")
	removeButton.Size = UDim2.fromOffset(35, 34)
	removeButton.Position = UDim2.new(1, -35, 0, 4)
	removeButton.BackgroundColor3 = Color3.fromRGB(48, 48, 55)
	removeButton.BackgroundTransparency = transparency
	removeButton.BorderSizePixel = 0
	removeButton.Text = "×"
	removeButton.TextColor3 = Color3.fromRGB(235, 80, 80)
	removeButton.TextSize = 19
	removeButton.Font = Enum.Font.GothamBold
	removeButton.ZIndex = 32
	removeButton.Parent = frame

	Instance.new("UICorner", removeButton).CornerRadius = UDim.new(0, 9)

	-- Send

	sendButton.Activated:Connect(function()
		sendMessage(message)
	end)

	-- Lock/unlock

	lockButton.Activated:Connect(function()
		config.locked = not config.locked

		if config.locked then
			lockButton.Text = "🔒"
		else
			lockButton.Text = "🔓"
		end

		saveSettings()
	end)

	-- Remove floating version only

	removeButton.Activated:Connect(function()
		quickConfig[message] = nil

		clearQuickDragConnections(frame)

		quickFrames[message] = nil

		frame:Destroy()

		saveSettings()
	end)

	--==================================================
	-- DRAGGING
	--==================================================

	local dragging = false
	local dragInput = nil
	local dragStart = nil
	local startPosition = nil

	local c1 = sendButton.InputBegan:Connect(function(input)
		if config.locked then
			return
		end

		if input.UserInputType == Enum.UserInputType.MouseButton1
			or input.UserInputType == Enum.UserInputType.Touch then

			dragging = true
			dragStart = input.Position
			startPosition = frame.Position
		end
	end)

	local c2 = sendButton.InputChanged:Connect(function(input)
		if input.UserInputType == Enum.UserInputType.MouseMovement
			or input.UserInputType == Enum.UserInputType.Touch then

			dragInput = input
		end
	end)

	local c3 = UserInputService.InputChanged:Connect(function(input)
		if not dragging then
			return
		end

		if input ~= dragInput then
			return
		end

		local delta = input.Position - dragStart

		local newX = startPosition.X.Offset + delta.X
		local newY = startPosition.Y.Offset + delta.Y

		newX, newY = clampQuickPosition(frame, newX, newY)

		frame.Position = UDim2.fromOffset(newX, newY)
	end)

	local c4 = UserInputService.InputEnded:Connect(function(input)
		if not dragging then
			return
		end

		if input.UserInputType == Enum.UserInputType.MouseButton1
			or input.UserInputType == Enum.UserInputType.Touch then

			dragging = false

			config.x = frame.Position.X.Offset
			config.y = frame.Position.Y.Offset

			saveSettings()
		end
	end)

	quickDragConnections[frame] = {
		c1,
		c2,
		c3,
		c4
	}
end

--//==================================================
--// REFRESH ALL FLOATING QUICK SENTENCES
--//==================================================

refreshQuickMinis = function()
	-- Remove old floating buttons

	for message, frame in pairs(quickFrames) do
		clearQuickDragConnections(frame)

		if frame then
			frame:Destroy()
		end

		quickFrames[message] = nil
	end

	if not quickSentencesEnabled then
		return
	end

	local seen = {}
	local index = 0

	for _, message in ipairs(messages) do
		if quickConfig[message] and not seen[message] then
			seen[message] = true
			index += 1

			createQuickMini(message, index)
		end
	end
end

--//==================================================
--// REFRESH SAVED MESSAGE LIST
--//==================================================

refreshMessages = function()
	for _, child in ipairs(messageScroll:GetChildren()) do
		if child:IsA("Frame") then
			child:Destroy()
		end
	end

	for index, message in ipairs(messages) do

		local row = Instance.new("Frame")
		row.Size = UDim2.new(1, -5, 0, 42)
		row.BackgroundColor3 = Color3.fromRGB(34, 34, 40)
		row.BackgroundTransparency = transparency
		row.BorderSizePixel = 0
		row.LayoutOrder = index
		row.ZIndex = 12
		row.Parent = messageScroll

		Instance.new("UICorner", row).CornerRadius = UDim.new(0, 11)

		-- Sentence

		local messageButton = Instance.new("TextButton")
		messageButton.Size = UDim2.new(1, -72, 1, 0)
		messageButton.Position = UDim2.fromOffset(0, 0)
		messageButton.BackgroundTransparency = 1
		messageButton.Text = message
		messageButton.TextColor3 = Color3.fromRGB(225, 225, 230)
		messageButton.TextSize = 13
		messageButton.Font = Enum.Font.Gotham
		messageButton.TextTruncate = Enum.TextTruncate.AtEnd
		messageButton.TextXAlignment = Enum.TextXAlignment.Left
		messageButton.ZIndex = 13
		messageButton.Parent = row

		local messagePadding = Instance.new("UIPadding")
		messagePadding.PaddingLeft = UDim.new(0, 12)
		messagePadding.PaddingRight = UDim.new(0, 5)
		messagePadding.Parent = messageButton

		-- FAST / QUICK BUTTON

		local quickButton = Instance.new("TextButton")
		quickButton.Size = UDim2.fromOffset(32, 32)
		quickButton.Position = UDim2.new(1, -67, 0, 5)
		quickButton.BackgroundColor3 = accentColor
		quickButton.BackgroundTransparency = transparency
		quickButton.BorderSizePixel = 0
		quickButton.Text = "⚡"
		quickButton.TextColor3 = Color3.fromRGB(245, 220, 90)
		quickButton.TextSize = 17
		quickButton.Font = Enum.Font.GothamBold
		quickButton.ZIndex = 14
		quickButton.Parent = row

		Instance.new("UICorner", quickButton).CornerRadius = UDim.new(0, 8)

		-- DELETE SAVED SENTENCE

		local deleteButton = Instance.new("TextButton")
		deleteButton.Size = UDim2.fromOffset(32, 32)
		deleteButton.Position = UDim2.new(1, -34, 0, 5)
		deleteButton.BackgroundColor3 = Color3.fromRGB(48, 48, 55)
		deleteButton.BackgroundTransparency = transparency
		deleteButton.BorderSizePixel = 0
		deleteButton.Text = "×"
		deleteButton.TextColor3 = Color3.fromRGB(235, 80, 80)
		deleteButton.TextSize = 18
		deleteButton.Font = Enum.Font.GothamBold
		deleteButton.ZIndex = 14
		deleteButton.Parent = row

		Instance.new("UICorner", deleteButton).CornerRadius = UDim.new(0, 8)

		-- Send normally

		messageButton.Activated:Connect(function()
			sendMessage(message)
		end)

		-- Create floating quick sentence

		quickButton.Activated:Connect(function()

			if quickConfig[message] then
				-- Already exists: just make sure it is visible
				quickSentencesEnabled = true
				updateQuickToggle()
				refreshQuickMinis()
				saveSettings()
				return
			end

			local x, y = getDefaultQuickPosition(index)

			quickConfig[message] = {
				x = x,
				y = y,
				locked = false
			}

			quickSentencesEnabled = true

			saveSettings()
			updateQuickToggle()
			refreshQuickMinis()
		end)

		-- Delete saved sentence

		deleteButton.Activated:Connect(function()

			-- Also remove its floating version
			quickConfig[message] = nil

			for i = #messages, 1, -1 do
				if messages[i] == message then
					table.remove(messages, i)
					break
				end
			end

			saveMessages()
			saveSettings()

			refreshMessages()
			refreshQuickMinis()
		end)
	end
end

--//==================================================
--// ADD SAVED MESSAGE
--//==================================================

local function addMessage()
	local text = inputBox.Text

	if not text or text == "" then
		return
	end

	text = text:gsub("^%s+", "")
	text = text:gsub("%s+$", "")

	if text == "" then
		return
	end

	table.insert(messages, text)

	inputBox.Text = ""

	saveMessages()
	refreshMessages()
end

--//==================================================
--// ADD BUTTON
--//==================================================

addButton.Activated:Connect(function()
	addMessage()
end)

inputBox.FocusLost:Connect(function(enterPressed)
	if enterPressed then
		addMessage()
	end
end)

--//==================================================
--// QUICK TOGGLE
--//==================================================

quickToggle.Activated:Connect(function()
	quickSentencesEnabled = not quickSentencesEnabled

	updateQuickToggle()
	saveSettings()
	refreshQuickMinis()
end)

--//==================================================
--// AUTO RANDOM
--//==================================================

autoButton.Activated:Connect(function()
	autoRandomEnabled = not autoRandomEnabled

	if autoRandomEnabled then
		autoButton.Text = "AUTO RANDOM • ON"
		autoButton.BackgroundColor3 = accentColor
	else
		autoButton.Text = "AUTO RANDOM • OFF"
		autoButton.BackgroundColor3 = Color3.fromRGB(34, 34, 40)
	end
end)

task.spawn(function()
	while gui.Parent do
		task.wait(AUTO_RANDOM_DELAY)

		if autoRandomEnabled and #messages > 0 then

			local randomIndex

			if #messages == 1 then
				randomIndex = 1
			else
				repeat
					randomIndex = math.random(1, #messages)
				until randomIndex ~= lastRandomIndex
			end

			lastRandomIndex = randomIndex

			sendMessage(messages[randomIndex])
		end
	end
end)

--//==================================================
--// SETTINGS
--//==================================================

settingsButton.Activated:Connect(function()
	settingsPanel.Visible = not settingsPanel.Visible
end)

settingsClose.Activated:Connect(function()
	settingsPanel.Visible = false
end)

scaleMinus.Activated:Connect(function()
	uiScale = math.clamp(uiScale - 0.1, 0.7, 1.4)

	saveSettings()
	updateSettingsLabels()

	gui:FindFirstChildOfClass("UIScale").Scale = uiScale
end)

scalePlus.Activated:Connect(function()
	uiScale = math.clamp(uiScale + 0.1, 0.7, 1.4)

	saveSettings()
	updateSettingsLabels()

	gui:FindFirstChildOfClass("UIScale").Scale = uiScale
end)

transparencyMinus.Activated:Connect(function()
	transparency = math.clamp(transparency - 0.05, 0, 0.7)

	saveSettings()
	updateSettingsLabels()

	main.BackgroundTransparency = transparency
	settingsPanel.BackgroundTransparency = transparency
	inputBox.BackgroundTransparency = transparency
	quickToggle.BackgroundTransparency = transparency
	autoButton.BackgroundTransparency = transparency
	addButton.BackgroundTransparency = transparency
	miniCircle.BackgroundTransparency = transparency

	refreshMessages()
	refreshQuickMinis()
end)

transparencyPlus.Activated:Connect(function()
	transparency = math.clamp(transparency + 0.05, 0, 0.7)

	saveSettings()
	updateSettingsLabels()

	main.BackgroundTransparency = transparency
	settingsPanel.BackgroundTransparency = transparency
	inputBox.BackgroundTransparency = transparency
	quickToggle.BackgroundTransparency = transparency
	autoButton.BackgroundTransparency = transparency
	addButton.BackgroundTransparency = transparency
	miniCircle.BackgroundTransparency = transparency

	refreshMessages()
	refreshQuickMinis()
end)

--//==================================================
--// MINIMIZE MAIN UI
--//==================================================

minimizeButton.Activated:Connect(function()
	main.Visible = false
	settingsPanel.Visible = false
	miniCircle.Visible = true
end)

miniCircle.Activated:Connect(function()
	main.Visible = true
	miniCircle.Visible = false
end)

--//==================================================
--// UISCALE
--//==================================================

local uiScaleObject = Instance.new("UIScale")
uiScaleObject.Scale = uiScale
uiScaleObject.Parent = gui

--//==================================================
--// INITIALIZE
--//==================================================

updateQuickToggle()
updateSettingsLabels()

refreshMessages()
refreshQuickMinis()

Features & Information

stores and sends chats (dont contact me for support) the new settings tab is kinda fucked up
#free#keyless#open source

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts