local prevposts = ""

while true do wait(1) local MGLUsername = script.Parent.Parent.Parent.Settings.Username.Value local ShowReplies = script.Parent.Parent.Parent.Settings.ShowReplies.Value local posts = game:GetService("HttpService"):GetAsync("http://www.mygameleaf.com/CONNECT/ROBLOX/" .. MGLUsername .. "/" .. tostring(ShowReplies) .. "/", true)

if posts ~= prevposts then
	
	for _, v in pairs(script.Parent:GetChildren()) do
		if v.Name == "Writer" or v.Name == "Post" then
			v:Destroy()
		end
	end
	
	if prevposts ~= "" then
		script.Parent.Parent.Parent.Open.Glow.Stop.Value = false
		script.Parent.Parent.Parent.Open.Glow.Disabled = false
	end
	
	prevposts = posts
	
	repeat
		local a, b = posts:find("'")
		if a and b then
			posts = posts:sub(1, a-1) .. "'" .. posts:sub(b+1)
		end
		wait()
	until not posts:find("'")
	
	repeat
		local a, b = posts:find("Created by MYGAMELEAF")
		if a and b then
			posts = posts:sub(1, a-1)
		end
	until not posts(:find("Created by MYGAMELEAF")
	
	local function giveLS(obj)
		local ls = script.LocalScript:clone()
		ls.Parent = obj
		ls.Disabled = false
	end
	
	local totalposts = 0
	local prevheight = 0
	local prevpos = 0
	
	--[[local RbxGui = assert(LoadLibrary('RbxGui'))
	
	local scrollFrame, scrollUp, scrollDown, recalculateScroll = RbxGui.CreateScrollingFrame(nil, "grid")
	
	scrollFrame.Parent = script.Parent
	scrollFrame.Position = UDim2.new(1, -17, 0, 20)
	scrollFrame.Size = UDim2.new(1, 0, 1, -20)
	
	local scrollBar = Instance.new("Frame", scrollFrame)
	scrollBar.Name = "Scrolling"
	scrollBar.BackgroundTransparency = 0.9
	scrollBar.BackgroundColor3 = Color3.new(1, 1, 1)
	scrollBar.BorderSizePixel = 0
	scrollBar.Size = UDim2.new(0, 17, 1, 0)
	scrollBar.Position = UDim2.new(0, 0, 0, 0)
	
	scrollDown.Position = UDim2.new(0, 0, 1, -17)
	
	scrollUp.Parent = scrollFrame
	scrollDown.Parent = scrollFrame]]
	
	repeat
		local a, b = posts:find("<font>")
		if a and b then
			posts = posts:sub(b+1)
		end
		local c, d = posts:find("</font>")
		if c and d then
			local writer = Instance.new("TextLabel", script.Parent)
			writer.Name = "Writer"
			-- writer.Text = posts:sub(1, c-1)
			writer.TextColor3 = totalposts == 0 and BrickColor.Red().Color or Color3.new(0, 170/255, 0)
			writer.TextStrokeTransparency = 0
			writer.BackgroundTransparency = 1
			writer.TextWrapped = true
			writer.Size = UDim2.new(1, 0, 0, 15)
			giveLS(writer)
			-- writer.Position = UDim2.new(0, 0, 0, 15 + 100*totalposts)
			repeat wait() until script.Parent.Boundz.Value ~= 13379001707
			writer.Position = UDim2.new(0, 0, 0, 20 + prevpos + prevheight)
			prevheight = script.Parent.Boundz.Value
			prevpos = writer.Position.Y.Offset
			writer.Text = posts:sub(1, c-1)
			script.Parent.Boundz.Value = 13379001707
			writer.TextXAlignment = totalposts == 0 and "Center" or "Left"
			writer.FontSize = totalposts == 0 and "Size10" or "Size8"
			posts = posts:sub(d+1)
			local post = Instance.new("TextLabel", script.Parent)
			post.Name = "Post"
			post.TextColor3 = Color3.new(1, 1, 1)
			post.TextStrokeTransparency = 0
			post.BackgroundTransparency = 1
			post.TextWrapped = true
			post.Size = UDim2.new(1, 0, 0, 1337)
			local e, f = posts:find("<font>")
			if e and f then
				post.Text = posts:sub(1, e-1)
			else
				post.Text = posts
			end
			wait()
			giveLS(post)
			-- post.Position = UDim2.new(0, 0, 0, 30 + 100*totalposts)
			repeat wait() until script.Parent.Boundz.Value ~= 13379001707
			post.Size = UDim2.new(1, 0, 0, script.Parent.Boundz.Value)
			post.Position = UDim2.new(0, 0, 0, 3 + prevpos + prevheight)
			prevheight = script.Parent.Boundz.Value
			prevpos = post.Position.Y.Offset
			wait()
			-- post.Text = tostring(prevheight)
			script.Parent.Boundz.Value = 13379001707
			post.TextXAlignment = totalposts == 0 and "Center" or "Left"
			post.TextYAlignment = "Top"
			post.FontSize = totalposts == 0 and "Size10" or "Size8"
		end
		totalposts = totalposts + 1
	until (not posts:find("</font>")) or totalposts >= 10
	
end

wait(60)

end