Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onKeyPress(inputObject, gameProcessedEvent)
- if inputObject.KeyCode == Enum.KeyCode.Return then
- if script.Parent.Focus.Value == true then
- script.Parent.Parent.Parent.msg.Value = script.Parent.Text
- script.Parent.Parent.Parent.player.Value = game.Players.LocalPlayer.Name
- script.Parent.Parent.Parent.RemoteEvent:FireServer()
- script.Parent:ReleaseFocus()
- end
- elseif inputObject.KeyCode == Enum.KeyCode.Slash then
- if script.Parent.Focus.Value == true then
- return
- else
- script.Parent.Focus.Value = true
- if game.Players.LocalPlayer.Character.Head:FindFirstChild("BillboardGui") then
- game.Players.LocalPlayer.Character.Head.BillboardGui:Destroy()
- script.Parent.Text = ""
- script.Parent:CaptureFocus()
- local bill = Instance.new("BillboardGui", game.Players.LocalPlayer.Character.Head)
- bill.Size = UDim2.new(3, 0, 1, 0)
- bill.AlwaysOnTop = true
- local label = Instance.new("TextLabel", bill)
- label.Size = UDim2.new(2, 0, 1, 0)
- label.BackgroundColor3 = Color3.new(43, 43, 43)
- label.Position = UDim2.new(-0.5, 0, -0.981, 1)
- label.TextScaled = true
- label.Text = ""
- label.BackgroundTransparency = 0.3
- label.FontSize = "Size14"
- label.BackgroundColor3 = Color3.new(43, 43, 43)
- else
- script.Parent.Text = ""
- script.Parent:CaptureFocus()
- local bill = Instance.new("BillboardGui", game.Players.LocalPlayer.Character.Head)
- bill.Size = UDim2.new(3, 0, 1, 0)
- bill.AlwaysOnTop = true
- local label = Instance.new("TextLabel", bill)
- label.Text = ""
- label.Size = UDim2.new(2, 0, 1, 0)
- label.BackgroundColor3 = Color3.new(43, 43, 43)
- label.Position = UDim2.new(-0.5, 0, -0.981, 1)
- label.TextScaled = true
- label.BackgroundTransparency = 0.3
- label.FontSize = "Size14"
- label.BackgroundColor3 = Color3.new(43, 43, 43)
- end
- end
- end
- end
- game:GetService("UserInputService").InputBegan:connect(onKeyPress)
- script.Parent.Changed:connect(function(change)
- if game.Players.LocalPlayer.Character.Head:FindFirstChild("BillboardGui") then
- if game.Players.LocalPlayer.Character.Head.BillboardGui:FindFirstChild("TextLabel") then
- game.Players.LocalPlayer.Character.Head.BillboardGui.TextLabel.Text = script.Parent.Text
- end
- end
- end)
- script.Parent.FocusLost:connect(function(lost)
- wait(0.01)
- if game.Players.LocalPlayer.Character.Head:FindFirstChild("BillboardGui") then
- game.Players.LocalPlayer.Character.Head.BillboardGui.TextLabel.Text = script.Parent.Text
- game.Players.LocalPlayer.Character.Head.BillboardGui.TextLabel.Name = "Perm"
- script.Parent.Focus.Value = false
- script.Parent.Text = "Press '/' To Chat."
- else
- script.Parent.Focus.Value = false
- script.Parent.Text = "Press '/' To Chat."
- end
- wait(3)
- for i,v in pairs(game.Players.LocalPlayer.Character.Head:GetChildren()) do
- if v.ClassName == "BillboardGui" then
- if v:FindFirstChild("Perm") then
- v:Destroy()
- end
- end
- end
- end)
Add Comment
Please, Sign In to add comment