-- KAIF CHAT (Speed Optimized)
local Player = game.Players.LocalPlayer
local CoreGui = game:GetService("CoreGui")
local RunService = game:GetService("RunService")
local TextService = game:GetService("TextService")
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- [FIX 1] Remote setup ko background mein daal diya taaki UI wait na kare
local Remote
task.spawn(function()
Remote = ReplicatedStorage:WaitForChild("KAIF_CHAT_SYNC", 5)
if Remote then
Remote.OnClientEvent:Connect(function(s_name, s_msg, s_id)
if s_name ~= Player.DisplayName then
_G.AddMessage(s_name, s_msg, s_id)
end
end)
end
end)
local SayMessage = ReplicatedStorage:FindFirstChild("DefaultChatSystemChatEvents") and ReplicatedStorage.DefaultChatSystemChatEvents:FindFirstChild("SayMessageRequest")
-- Cleanup
if CoreGui:FindFirstChild("DeltaRGB_Fixed") then CoreGui.DeltaRGB_Fixed:Destroy() end
local Root = Instance.new("ScreenGui", CoreGui)
Root.Name = "DeltaRGB_Fixed"
Root.DisplayOrder = 99999
Root.IgnoreGuiInset = true
-- Helpers
local function ApplyRGB(object, property)
task.spawn(function()
while object and object.Parent do
local hue = (tick() % 5) / 5
object[property] = Color3.fromHSV(hue, 0.8, 1)
RunService.Heartbeat:Wait() -- RenderStepped se better performance
end
end)
end
---------------------------------------------------
-- UI CODE (Slightly compressed for speed)
---------------------------------------------------
local KIcon = Instance.new("TextButton", Root)
KIcon.Size = UDim2.new(0, 50, 0, 50)
KIcon.Position = UDim2.new(0, 20, 0.45, 0)
KIcon.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
KIcon.Text = "K"
KIcon.Font = Enum.Font.GothamBold
KIcon.TextColor3 = Color3.new(1, 1, 1)
KIcon.TextSize = 25
KIcon.Draggable = true
KIcon.Active = true
Instance.new("UICorner", KIcon).CornerRadius = UDim.new(0, 12)
local KStroke = Instance.new("UIStroke", KIcon)
KStroke.Thickness = 3
ApplyRGB(KStroke, "Color")
local Main = Instance.new("CanvasGroup", Root)
Main.Size = UDim2.new(0, 350, 0, 300)
Main.Position = UDim2.new(0.5, -175, 0.5, -150)
Main.BackgroundColor3 = Color3.fromRGB(12, 12, 15)
Main.Visible = false
Main.GroupTransparency = 1
Instance.new("UICorner", Main).CornerRadius = UDim.new(0, 12)
ApplyRGB(Instance.new("UIStroke", Main), "Color")
local Scroll = Instance.new("ScrollingFrame", Main)
Scroll.Size = UDim2.new(0.92, 0, 0.60, 0)
Scroll.Position = UDim2.new(0.04, 0, 0.15, 0)
Scroll.BackgroundTransparency = 1
Scroll.ScrollBarThickness = 2
local UIList = Instance.new("UIListLayout", Scroll)
UIList.Padding = UDim.new(0, 5)
local InputFrame = Instance.new("Frame", Main)
InputFrame.Size = UDim2.new(0.92, 0, 0, 40)
InputFrame.Position = UDim2.new(0.04, 0, 0.82, 0)
InputFrame.BackgroundColor3 = Color3.fromRGB(25, 25, 30)
Instance.new("UICorner", InputFrame).CornerRadius = UDim.new(0, 8)
local TextBox = Instance.new("TextBox", InputFrame)
TextBox.Size = UDim2.new(1, -20, 1, 0)
TextBox.Position = UDim2.new(0, 10, 0, 0)
TextBox.BackgroundTransparency = 1
TextBox.PlaceholderText = "Type message here..."
TextBox.Text = ""
TextBox.TextColor3 = Color3.new(1, 1, 1)
TextBox.Font = Enum.Font.GothamMedium
TextBox.TextSize = 14
---------------------------------------------------
-- FAST MESSAGE SYSTEM
---------------------------------------------------
_G.AddMessage = function(user, msg, userId)
local Label = Instance.new("TextLabel", Scroll)
Label.Size = UDim2.new(1, -10, 0, 20)
Label.BackgroundTransparency = 1
Label.RichText = true
Label.TextSize = 14
Label.Font = Enum.Font.Gotham
Label.TextXAlignment = Enum.TextXAlignment.Left
Label.TextWrapped = true
if userId == 7169032620 or userId == 10359585068 then
local tag = (userId == 7169032620) and "{CO-OWNER}" or "[CREATOR]"
task.spawn(function()
while Label and Label.Parent do
local hex = Color3.fromHSV(tick() % 5 / 5, 0.8, 1):ToHex()
Label.Text = ''..tag..' ' .. user .. ': ' .. msg .. ''
RunService.Heartbeat:Wait()
end
end)
else
Label.Text = '' .. user .. ': ' .. msg
end
Scroll.CanvasSize = UDim2.new(0, 0, 0, UIList.AbsoluteContentSize.Y)
Scroll.CanvasPosition = Vector2.new(0, UIList.AbsoluteContentSize.Y)
end
-- Toggle logic
KIcon.MouseButton1Click:Connect(function()
local visible = not Main.Visible
if visible then Main.Visible = true end
TweenService:Create(Main, TweenInfo.new(0.2), {GroupTransparency = visible and 0 or 1}):Play()
task.delay(0.2, function() if not visible then Main.Visible = false end end)
end)
TextBox.FocusLost:Connect(function(enter)
if enter and TextBox.Text ~= "" then
local m = TextBox.Text
TextBox.Text = ""
if Remote then Remote:FireServer(m) end
if SayMessage then SayMessage:FireServer(m, "All") end
_G.AddMessage(Player.DisplayName, m, Player.UserId)
end
end)
_G.AddMessage("SYSTEM", "KAIF CHAT LOADED!", 0)