Skip to content

Instantly share code, notes, and snippets.

@spotco
Last active March 29, 2019 03:26
Show Gist options
  • Save spotco/cdb805bdef77708e5093282b19ffe10d to your computer and use it in GitHub Desktop.
Save spotco/cdb805bdef77708e5093282b19ffe10d to your computer and use it in GitHub Desktop.
Minimal topbar (Used in 2017 Egghunt and ROBEATS)
wait()
game.Players.LocalPlayer:WaitForChild("PlayerGui")
local screengui = Instance.new("ScreenGui",game.Players.LocalPlayer.PlayerGui)
screengui.ResetOnSpawn = false
local frame = Instance.new("Frame",screengui)
frame.Name = "ChatTopbar"
frame.BackgroundColor3 = Color3.new(0,0,0)
frame.BackgroundTransparency = 0.6
frame.Size = UDim2.new(0,120,0,37)
frame.Position = UDim2.new(0,0,0,-36)
local imagebutton = Instance.new("ImageLabel",frame)
imagebutton.BackgroundTransparency = 1
imagebutton.Size = UDim2.new(0,35,0,33)
imagebutton.Position = UDim2.new(0,83,0,6)
do
local chat_active = game.StarterGui:GetCore("ChatActive")
if chat_active then
imagebutton.Image = "rbxasset://textures/ui/Chat/ChatDown@2x.png"
else
imagebutton.Image = "rbxasset://textures/ui/Chat/Chat@2x.png"
end
end
game:GetService("UserInputService").InputBegan:Connect(function(evt)
if evt.UserInputType == Enum.UserInputType.MouseButton1 then
local pos_offset = Vector2.new(evt.Position.X,evt.Position.Y + 36)
if pos_offset.X > imagebutton.Position.X.Offset and
pos_offset.X < imagebutton.Position.X.Offset + imagebutton.Size.X.Offset and
pos_offset.Y > imagebutton.Position.Y.Offset and
pos_offset.Y < imagebutton.Position.Y.Offset + imagebutton.Size.Y.Offset then
local chat_active = game.StarterGui:GetCore("ChatActive")
local tar_active = not chat_active
game.StarterGui:SetCore("ChatActive",tar_active)
if tar_active then
imagebutton.Image = "rbxasset://textures/ui/Chat/ChatDown@2x.png"
else
imagebutton.Image = "rbxasset://textures/ui/Chat/Chat@2x.png"
end
end
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment