Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rep = game:GetService("ReplicatedStorage")
- local chatted = rep:WaitForChild("Chatted")
- local uis = game:GetService("UserInputService")
- local deb = game:GetService("Debris")
- local par = script.Parent
- repeat task.wait(.1) until par:FindFirstChild("Frame")
- local Box,Chat = par.Frame:FindFirstChild("Box"), par.Frame:FindFirstChild("Chat")
- local Focus = Enum.KeyCode.Slash -- "/" key
- uis.InputEnded:Connect(function(input,x)
- if not x then
- if input.KeyCode == Focus then
- task.wait()
- Chat:CaptureFocus() -- focus to the textbox
- end
- end
- end)
- Chat.FocusLost:Connect(function(Enter)
- if Enter then -- check if Enter was pressed
- chatted:FireServer(Chat.Text)
- Chat:ReleaseFocus() -- release textbox focus
- Chat.Text = "" -- clear textbox
- end
- end)
- chatted.OnClientEvent:Connect(function(String)
- if typeof(String) == "string" then -- check if its a string or not
- local temp = Box:WaitForChild("Temp"):Clone()
- temp.Parent = Box
- temp.Visible = true
- temp.LayoutOrder = #Box:GetChildren()
- temp.Text = String
- deb:AddItem(temp,300) -- clean up
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment