local StreamOnline = false

local StreamValue = Instance.new("BoolValue") StreamValue.Name = "StreamOnline"

local ViewerValue = Instance.new("IntValue") ViewerValue.Name = "Viewers" ViewerValue.Parent = StreamValue

local TitleValue = Instance.new("StringValue") TitleValue.Name = "Title" TitleValue.Parent = StreamValue

StreamValue.Parent = game.ReplicatedStorage

local Billboard = game.ServerStorage.TwitchBillboard

local TwitchPart = game.ServerStorage.Twitch

while wait(10) do local json = game.HttpService:GetAsync("https://api.twitch.tv/kraken/streams/bereza12",true,{["Client-Id"] = "3ub3zo5itnwhs4fvaa25h0wxw6rt0l8"})

local streamInfo = game.HttpService:JSONDecode(json)
if streamInfo.stream ~= nil and streamInfo.stream ~= "null" then
	if not StreamOnline then
		StreamOnline = true
		StreamValue.Value = true
		TwitchPart.Parent = workspace
		game.ReplicatedStorage.Announce:FireAllClients("Twitchite has appeared in the mines!",5,Color3.new(0.8,0.3,1))
		game.ReplicatedStorage.Announce:FireAllClients("The more live viewers twitch.tv/bereza12 gets, the more it spawns!",5,Color3.new(0.8,0.3,1))
		Billboard.Parent = workspace
		-- show gui
	else

	end
	StreamValue.Viewers.Value = tonumber(streamInfo.stream.viewers)
	game.ReplicatedStorage.Ores.Twitchite.MaxRarity.Value = math.ceil(StreamValue.Viewers.Value / 100)
	game.ReplicatedStorage.Ores.Twitchite.MinRarity.Value = math.ceil(StreamValue.Viewers.Value / 100)
	game.ReplicatedStorage.Ores.Twitchite.XP.Value = tonumber(streamInfo.stream.viewers)
	StreamValue.Title.Value = streamInfo.stream.channel.status
	Billboard.Part.GUI.Viewers.Text = streamInfo.stream.viewers.." watching right now"
else
	game.ReplicatedStorage.Ores.Twitchite.MaxRarity.Value = 0
	game.ReplicatedStorage.Ores.Twitchite.MinRarity.Value = 0
	game.ReplicatedStorage.Ores.Twitchite.XP.Value = 0
	StreamOnline = false
	StreamValue.Value = false
	TwitchPart.Parent = game.ServerStorage
	Billboard.Parent = game.ServerStorage
end

end